Skip to content
Snippets Groups Projects
Commit 84d1a59d authored by ale's avatar ale
Browse files

Improve logging of command execution failures

Previously the mailman command output was sent to /dev/null.
parent 5f4b1224
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,16 @@ mm_env['LANG'] = 'C'
mm_env['LC_ALL'] = 'C'
def _run(cmd):
subprocess.check_call(cmd, env=mm_env)
app.logger.info('running %s', cmd)
try:
subprocess.run(
cmd, check=True, env=mm_env,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
app.logger.error('command FAILED (status=%d), output:\n%s\n',
e.returncode, e.stdout.decode('utf-8'))
raise
def _random_password():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment