From 9d4ab5ea654e8990ad3ca411975406edc96fca64 Mon Sep 17 00:00:00 2001 From: Jesse Nava <code@nava.xyz> Date: Mon, 9 Oct 2023 15:21:21 -0400 Subject: [PATCH] update for current dependencies --- exec/bot.py | 2 +- exec/runner/base.py | 4 ++-- exec/runner/shell.py | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/exec/bot.py b/exec/bot.py index 59eb2e9..3294550 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 cc73320..d7ddf5c 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 5694dc7..827328e 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]]: -- GitLab