From a06c278a2020c4ea45d96c5f46006d14d2c6f56d Mon Sep 17 00:00:00 2001 From: Fabrice Laporte Date: Wed, 17 Sep 2014 21:58:14 +0200 Subject: [PATCH] add stderr to exception raised by command_output --- beets/util/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/beets/util/__init__.py b/beets/util/__init__.py index 428de312a..bc07460e8 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -633,13 +633,14 @@ def command_output(cmd, shell=False): Python 2.6 and which can have problems if lots of output is sent to stderr. """ - with open(os.devnull, 'wb') as devnull: - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=devnull, - close_fds=platform.system() != 'Windows', - shell=shell) - stdout, _ = proc.communicate() + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + close_fds=platform.system() != 'Windows', + shell=shell) + stdout, stderr = proc.communicate() + if proc.returncode: - raise subprocess.CalledProcessError(proc.returncode, cmd) + raise subprocess.CalledProcessError(proc.returncode, cmd, stderr) return stdout