Add exception handling for Python's 'subprocess' methods #594
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, if you don't have valgrind and you would like to run valgrind test, an unhandled exception happens:
Traceback (most recent call last):
File "tools/build.py", line 809, in
if not run_checktest(option):
File "tools/build.py", line 736, in run_checktest
path.CHECKTEST_PATH] + build_args)
File "/home/rtakacs/iotjs/tools/common_py/system/executor.py", line 46, in run_cmd
return subprocess.call([cmd] + args)
File "/usr/lib/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 710, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
The fix will catch the exception and handle it.