When a needed shell command is not installed the error message just says "file not found" without showing what file. This change exposes the command line that failed to run and repeats the error message.

This commit is contained in:
Doug Hellmann 2012-03-07 16:15:27 -05:00
parent 9186e6440d
commit 6e7ba70def

View File

@ -129,18 +129,21 @@ def execute(*cmd, **kwargs):
rc = None
result = None
with Rooted(run_as_root):
obj = subprocess.Popen(execute_cmd,
stdin=stdin_fh,
stdout=stdout_fh,
stderr=stderr_fh,
close_fds=close_file_descriptors,
cwd=cwd,
shell=shell,
env=process_env)
if process_input is not None:
result = obj.communicate(str(process_input))
else:
result = obj.communicate()
try:
obj = subprocess.Popen(execute_cmd,
stdin=stdin_fh,
stdout=stdout_fh,
stderr=stderr_fh,
close_fds=close_file_descriptors,
cwd=cwd,
shell=shell,
env=process_env)
if process_input is not None:
result = obj.communicate(str(process_input))
else:
result = obj.communicate()
except OSError as e:
raise RuntimeError('Could not run %s: %s' % (execute_cmd, e))
if (stdin_fh != subprocess.PIPE
and obj.stdin and close_stdin):
obj.stdin.close()