From: Date: Thu, 27 Dec 2012 03:03:22 +0000 (-0800) Subject: unify subprocess handling X-Git-Url: https://diplodocus.org/git/flac-archive/commitdiff_plain/066062f83099a15ddb9cf5154e217b2c58ddea33?hp=008e82b0685c219dc12f8183a7906b7d3d8131c8 unify subprocess handling --- diff --git a/rewrite-tags b/rewrite-tags index c44a27b..d4ce48c 100755 --- a/rewrite-tags +++ b/rewrite-tags @@ -4,7 +4,6 @@ import os, sys import subprocess import tempfile from errno import EEXIST -from subprocess import Popen, PIPE from flac_archive.tags import Tags @@ -27,12 +26,13 @@ def get_tags(fn): tags = Tags() command = ['metaflac', '--no-utf8-convert', '--export-tags-to=-', fn] - p = Popen(command, stdout=PIPE) + p = subprocess.Popen(command, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) tags.load(p.stdout) status = p.wait() if status != 0: - raise SubprocessError(status, command=command, stderr=p.stderr) + raise SubprocessError(status, command=command, stderr=p.stdout) return tags @@ -41,7 +41,8 @@ def rewrite_track_tags(track, tags, fn, tmp): tmp.close() command = ['metaflac', '--no-utf8-convert', '--dont-use-padding', '--remove-all-tags', '--import-tags-from', tmp.name, fn] - p = Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + p = subprocess.Popen(command, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) stdout, stderr = p.communicate() status = p.wait() if status != 0: