Return both stdout and stderr on pip failures.

pip failure message sometimes (always?) go to standard out. Return
both standard out and standard error when there's a failure.
This commit is contained in:
Lorin Hochstein 2012-08-17 11:32:47 -04:00
parent fe923b9394
commit 8af3403f65

View file

@ -178,7 +178,13 @@ def main():
err += err_pip err += err_pip
if rc != 0: if rc != 0:
module.fail_json(msg=err, cmd=cmd) if not out:
msg = err
elif not err:
msg = out
else:
msg = "stdout: %s\n:stderr: %s" % (out, err)
module.fail_json(msg=msg, cmd=cmd)
module.exit_json(changed=changed, cmd=cmd, name=name, version=version, module.exit_json(changed=changed, cmd=cmd, name=name, version=version,
state=state, requirements=requirements, virtualenv=env) state=state, requirements=requirements, virtualenv=env)