- changed status to resolved
Nice error message when command not found
Issue #37
resolved
Currently if a command/executable doesn't exist, on Unix the result is an OSError without much detail to explain what went wrong. This is the exception that subprocess emits, and it is not user-friendly.
It would be nice if sarge could detect the OSError errno and try to verify that the problem was the command was missing, and show a more meaningful error message.
i.e. currently the error for a missing command is
...
stderr=sarge.Capture(),
File "/usr/lib/python2.7/site-packages/sarge/__init__.py", line 1428, in run
p.run(input=input, async=async)
File "/usr/lib/python2.7/site-packages/sarge/__init__.py", line 1042, in run
self.run_node(node, input=input, async=False)
File "/usr/lib/python2.7/site-packages/sarge/__init__.py", line 1153, in run_node
result = getattr(self, method)(node, input, async)
File "/usr/lib/python2.7/site-packages/sarge/__init__.py", line 1299, in run_command_node
node.cmd.run(input=input, async=async)
File "/usr/lib/python2.7/site-packages/sarge/__init__.py", line 632, in run
self.process = p = Popen(self.args, **self.kwargs)
File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/site-packages/sarge/__init__.py", line 545, in _execute_child
super(Popen, self)._execute_child(args, executable, preexec, *rest)
File "/usr/lib64/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Comments (1)
-
repo owner - Log in to comment
Fixes
#37: Added a better error message for a missing command.→ <<cset 17751000e871>>