diff --git a/exec/bot.py b/exec/bot.py index 59eb2e931cdfa2a5ef720dd7dfc37a64160ae7cf..329455011de6686659cba53403614ea7260be0c3 100644 --- a/exec/bot.py +++ b/exec/bot.py @@ -97,7 +97,7 @@ class ExecBot(Plugin): or not evt.content.formatted_body)): return - command = EntityParser.parse(evt.content.formatted_body) + command = await EntityParser().parse(evt.content.formatted_body) entity: SimpleEntity code: Optional[str] = None lang: Optional[str] = None diff --git a/exec/runner/base.py b/exec/runner/base.py index cc73320d2c63e9576f582ce4008740b9abbd0381..d7ddf5ce36e332f2cd30b9e6d6bd91f5dff4160d 100644 --- a/exec/runner/base.py +++ b/exec/runner/base.py @@ -33,9 +33,9 @@ class AsyncTextOutput: closed: bool def __init__(self, loop: Optional[AbstractEventLoop] = None) -> None: - self.loop = loop or get_event_loop() + self.loop = get_event_loop() self.read_task = None - self.queue = Queue(loop=self.loop) + self.queue = Queue() self.closed = False def __aiter__(self) -> 'AsyncTextOutput': diff --git a/exec/runner/shell.py b/exec/runner/shell.py index 5694dc7547a459decf6d210ae306f343253e07f4..827328e2b25a6941ace12c53f616a9c89a47399a 100644 --- a/exec/runner/shell.py +++ b/exec/runner/shell.py @@ -80,7 +80,7 @@ class ShellRunner(Runner): ) -> AsyncGenerator[Tuple[OutputType, Union[str, int]], None]: loop = loop or asyncio.get_event_loop() output = AsyncTextProxy() - proc = await asyncio.create_subprocess_shell(code, loop=loop, + proc = await asyncio.create_subprocess_shell(code, stdin=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE) @@ -91,6 +91,7 @@ class ShellRunner(Runner): waiter = asyncio.ensure_future(self._wait_proc(proc, output), loop=loop) async for part in output: yield part + print(output) yield (OutputType.RETURN, await waiter) def format_exception(self, exc_info: Any) -> Tuple[Optional[str], Optional[str]]: