From 9ff587cf36f042f12e8c350f8897b13690a984fd Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Fri, 11 Feb 2011 02:15:18 -0700 Subject: Don't error out just from stderr from rpm Rpm can be bitchy, but also return 0, so handle that. Also try to do something meaningful / useful with the error output. --- src/pyfedpkg/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index 3bb414d..a9d090f 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -109,7 +109,15 @@ def _name_from_spec(spec): except OSError, e: raise FedpkgError(e) if error: - raise FedpkgError(error) + if sys.stdout.isatty(): + sys.stderr.write(error) + else: + # Yes, we could wind up sending error output to stdout in the + # case of no local tty, but I don't have a better way to do this. + log.info(error) + if proc.returncode: + raise FedpkgError('Could not parse the spec, exited %s' % + proc.returncode) return output.split()[0] def _run_command(cmd, shell=False, env=None, pipe=[], cwd=None): -- cgit