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