diff options
author | Jesse Keating <jkeating@redhat.com> | 2011-02-11 02:15:18 -0700 |
---|---|---|
committer | Jesse Keating <jkeating@redhat.com> | 2011-02-11 02:15:18 -0700 |
commit | 9ff587cf36f042f12e8c350f8897b13690a984fd (patch) | |
tree | 066e1f1a11d3079225d6be278fe2c1071b72d193 | |
parent | ff91098ad907f4182ce95ef95183ea8891d78882 (diff) | |
download | fedora-packager-9ff587cf36f042f12e8c350f8897b13690a984fd.tar.gz fedora-packager-9ff587cf36f042f12e8c350f8897b13690a984fd.tar.xz fedora-packager-9ff587cf36f042f12e8c350f8897b13690a984fd.zip |
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.
-rw-r--r-- | src/pyfedpkg/__init__.py | 10 |
1 files changed, 9 insertions, 1 deletions
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): |