commit 8a4da5f8504ce65d63b5a2f8174264869d2bbbda
parent 13711698f50568aaae930471fa32da52b8695974
Author: Marcel <MTRNord@users.noreply.github.com>
Date: Fri, 11 Nov 2016 20:01:55 +0100
Try to do it async
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/intel_screenbot/__init__.py b/intel_screenbot/__init__.py
@@ -30,12 +30,12 @@ def _screencap(url, filename, SACSID, CSRF, search, bot, event):
# make sure phantomjs has time to download/process the page
# but if we get nothing after 30 sec, just move on
try:
- output, errors = process.communicate(timeout=30)
+ output, errors = yield from process.communicate(timeout=30)
except Exception as e:
logger.debug("Exception: {}".format(e))
process.kill()
while True:
- out = process.stdout.read(1)
+ out = yield from process.stdout.read(1)
if out:
yield from bot.coro_send_message(event.conv_id, "<i>{}</i>".format(out))
loop = asyncio.get_event_loop()