From d3aab505b33f0626824a82e04af05c47410f03d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= <sybren@stuvel.eu> Date: Thu, 15 Nov 2018 12:23:29 +0100 Subject: [PATCH] Better logging when a command fails --- flamenco_worker/commands.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/flamenco_worker/commands.py b/flamenco_worker/commands.py index 2e1afa36..e3b66647 100644 --- a/flamenco_worker/commands.py +++ b/flamenco_worker/commands.py @@ -506,10 +506,12 @@ class AbstractSubprocessCommand(AbstractCommand): await self.worker.register_log(processed_line) retcode = await self.proc.wait() - self._log.info('Command %r (pid=%d) stopped with status code %s', args, pid, retcode) + cmdline = ' '.join(shlex.quote(arg) for arg in args) + self._log.info('Command %r (pid=%d) stopped with status code %s', cmdline, pid, retcode) if retcode: - raise CommandExecutionError('Command pid=%d failed with status %s' % (pid, retcode)) + raise CommandExecutionError('Command %r (pid=%d) failed with status %s' % + (cmdline, pid, retcode)) except asyncio.CancelledError: self._log.info('asyncio task got canceled, killing subprocess pid=%d', pid) await self.abort() -- GitLab