From d20631e69f9b9bf9d7333773bebfc346acaa02ec Mon Sep 17 00:00:00 2001 From: Arksine Date: Sun, 7 Mar 2021 09:11:11 -0500 Subject: [PATCH] shell_command: enable stderr if a callback is set Signed-off-by: Eric Callahan --- moonraker/plugins/shell_command.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/moonraker/plugins/shell_command.py b/moonraker/plugins/shell_command.py index e911602..607573a 100644 --- a/moonraker/plugins/shell_command.py +++ b/moonraker/plugins/shell_command.py @@ -161,8 +161,10 @@ class ShellCommand: return asyncio.subprocess.SubprocessStreamProtocol( limit=2**20, loop=loop) try: - errpipe = asyncio.subprocess.PIPE if self.log_stderr \ - else asyncio.subprocess.STDOUT + if self.std_err_cb is not None or self.log_stderr: + errpipe = asyncio.subprocess.PIPE + else: + errpipe = asyncio.subprocess.STDOUT transport, protocol = await loop.subprocess_exec( protocol_factory, *self.command, stdout=asyncio.subprocess.PIPE,