From 8a432d355dd0da9b653eeff4d964dffa727dea52 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Tue, 22 May 2018 10:43:01 +0200 Subject: [PATCH] Make the meetbot SAR script more resilient Signed-off-by: Pierre-Yves Chibon --- roles/supybot/files/meetbot_sar.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/roles/supybot/files/meetbot_sar.py b/roles/supybot/files/meetbot_sar.py index 42275db107..4ead9bfa18 100644 --- a/roles/supybot/files/meetbot_sar.py +++ b/roles/supybot/files/meetbot_sar.py @@ -32,7 +32,13 @@ def main(): os.chdir(_logs_folder) def _grep_and_process(command): - cli_out = subprocess.check_output(command).decode('utf-8') + cli_out = '' + try: + cli_out = subprocess.check_output(command).decode('utf-8') + except subprocess.CalledProcessError as err: + if err.output: + print('ERROR: command: %s returned: %s' % (command, err.returncode)) + print('ERROR: output: %s' % (err.output)) lines = cli_out.split('\n') for line in lines: if line.startswith('./'):