From ec8c530a7004f426abc15b1088de7e0dc315d0e7 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Sun, 19 Sep 2010 11:56:45 -0700 Subject: Exit with an error when appropriate When dealing with the pipe stuff, we need to catch if the first command exits with an error, because that error won't carry through to the piped command. Fixes RHBZ:634888 --- src/pyfedpkg/__init__.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index f913774..96f8fc9 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -167,6 +167,9 @@ def _run_command(cmd, shell=False, env=None, pipe=[], cwd=None): stdin=proc.stdout, shell=shell, cwd=cwd) + (output, err) = proc.communicate() + if proc.returncode: + raise FedpkgError('Non zero exit') else: subprocess.check_call(command, env=environ, stdout=sys.stdout, stderr=sys.stderr, shell=shell, -- cgit