From b6af1942c8775cf84814aea450e67d20a9a2a2ba Mon Sep 17 00:00:00 2001 From: Tamas Gal <tgal@km3net.de> Date: Fri, 4 Oct 2019 18:18:56 +0200 Subject: [PATCH] Return error if any --- scripts/chatbot.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/chatbot.py b/scripts/chatbot.py index 30551eb..8bed455 100644 --- a/scripts/chatbot.py +++ b/scripts/chatbot.py @@ -92,8 +92,11 @@ def register_handlers(bot): "Sorry @{}, only operators and shifters are allowed to mess " "with me, sorry...".format(user), channel_id) return - output = subprocess.check_output(['supervisorctl'] + - msg.split()).decode('ascii') + try: + output = subprocess.check_output(['supervisorctl'] + + msg.split()).decode('ascii') + except subprocess.CalledProcessError as e: + output = e.output.decode('ascii') bot.send_message(output, channel_id) def shifters(msg, user, channel_id): -- GitLab