From 1325b01e25814c7dd2d5fe1f2fe1b7a16c286e93 Mon Sep 17 00:00:00 2001 From: mhagger Date: Sat, 16 Oct 2010 08:33:45 +0000 Subject: [PATCH] Use Popen.communicate() instead of own, fragile code. git-svn-id: http://cvs2svn.tigris.org/svn/cvs2svn/trunk@5292 be7e6eca-30d4-0310-a8e5-ac0d63af7087 --- cvs2svn_lib/process.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/cvs2svn_lib/process.py b/cvs2svn_lib/process.py index c39739fc..55b903fd 100644 --- a/cvs2svn_lib/process.py +++ b/cvs2svn_lib/process.py @@ -79,14 +79,11 @@ def check_command_runs(command, commandname): ) except OSError, e: raise CommandFailedException('error executing %s: %s' % (commandname, e,)) - pipe.stdin.close() - pipe.stdout.read() - errmsg = pipe.stderr.read() - status = pipe.wait() - if status or errmsg: - msg = 'error executing %s: status %s' % (commandname, status,) - if errmsg: - msg += ', error output:\n%s' % (errmsg,) + (stdout, stderr) = pipe.communicate() + if pipe.returncode or stderr: + msg = 'error executing %s; returncode=%s' % (commandname, pipe.returncode,) + if stderr: + msg += ', error output:\n%s' % (stderr,) raise CommandFailedException(msg) -- 2.11.4.GIT