From 26808790680c96b7a6aff48982a15b28730d7e41 Mon Sep 17 00:00:00 2001 From: Fabian Date: Mon, 22 May 2017 22:00:44 +0200 Subject: [PATCH] Print stdout when running a hook (#4167, #4487) (#4702) --- certbot/hooks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/certbot/hooks.py b/certbot/hooks.py index 75d7a3b20..b3c1fc3e2 100644 --- a/certbot/hooks.py +++ b/certbot/hooks.py @@ -126,11 +126,13 @@ def execute(shell_cmd): cmd = Popen(shell_cmd, shell=True, stdout=PIPE, stderr=PIPE, universal_newlines=True) out, err = cmd.communicate() + base_cmd = os.path.basename(shell_cmd.split(None, 1)[0]) + if out: + logger.info('Output from %s:\n%s', base_cmd, out) if cmd.returncode != 0: logger.error('Hook command "%s" returned error code %d', shell_cmd, cmd.returncode) if err: - base_cmd = os.path.basename(shell_cmd.split(None, 1)[0]) logger.error('Error output from %s:\n%s', base_cmd, err) return (err, out)