mirror of https://github.com/ARMmbed/mbed-os.git
Checking if path exists before running command
There was no path checking before running a command resulting in a waste of time trying to find the issue. This was amplified by the fact that no mention of where the error occurs was made, and neither which path that the error was raised for.pull/1095/head
parent
53280295ab
commit
ecc0e32440
|
@ -31,12 +31,16 @@ def cmd(l, check=True, verbose=False, shell=False, cwd=None):
|
|||
|
||||
|
||||
def run_cmd(command, wd=None, redirect=False):
|
||||
if not exists(command[0]):
|
||||
error('run_cmd(): %s path does not exist' % command[0])
|
||||
p = Popen(command, stdout=PIPE, stderr=STDOUT if redirect else PIPE, cwd=wd)
|
||||
_stdout, _stderr = p.communicate()
|
||||
return _stdout, _stderr, p.returncode
|
||||
|
||||
|
||||
def run_cmd_ext(command):
|
||||
if not exists(command[0]):
|
||||
error('run_cmd_ext(): %s path does not exist' % command[0])
|
||||
p = Popen(command, stdout=PIPE, stderr=PIPE)
|
||||
_stdout, _stderr = p.communicate()
|
||||
return _stdout, _stderr, p.returncode
|
||||
|
|
Loading…
Reference in New Issue