From ce70a9fb4de6401aa21023bd3c90eec054f214a5 Mon Sep 17 00:00:00 2001 From: xeals Date: Thu, 27 Apr 2023 12:28:09 +1000 Subject: [PATCH] capture stderr on good calculations --- bot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 82d0c1e..32ef752 100755 --- a/bot.py +++ b/bot.py @@ -101,8 +101,11 @@ class BotClient(discord.Client): proc = sp.run( ["node", "calc_main.js", "--"] + args, stdout=sp.PIPE, stderr=sp.PIPE ) + stderr = proc.stderr.decode().strip() if proc.returncode != 0: - raise Exception(proc.stderr.decode()) + raise Exception(stderr) + if stderr: + _log.warning(f"running calculation '{args}': {stderr}") return proc.stdout.decode() def is_replay(self, message: discord.Message) -> bool: