kopia lustrzana https://github.com/OpenDroneMap/ODM
Use subprocess.call in place of os.system
Also removes the buried exit() in favor of raising an Exception to be
handled or ignored, resulting in the same behavior (but with a non-zero
exit code).
Former-commit-id: 7172502f97
pull/1161/head
rodzic
1b183ab7c7
commit
36d30c9aa7
|
@ -16,15 +16,16 @@ def get_ccd_widths():
|
|||
sensor_data = json.loads(f.read())
|
||||
return dict(zip(map(string.lower, sensor_data.keys()), sensor_data.values()))
|
||||
|
||||
|
||||
def run(cmd):
|
||||
"""Run a system command"""
|
||||
log.ODM_DEBUG('running %s' % cmd)
|
||||
returnCode = os.system(cmd)
|
||||
retcode = subprocess.call(cmd, shell=True)
|
||||
|
||||
if (returnCode != 0):
|
||||
log.ODM_ERROR("quitting cause: \n\t" + cmd + "\nreturned with code " +
|
||||
str(returnCode) + ".\n")
|
||||
sys.exit('An error occurred. Check stdout above or the logs.')
|
||||
if retcode < 0:
|
||||
raise Exception("Child was terminated by signal {}".format(-retcode))
|
||||
elif retcode > 0:
|
||||
raise Exception("Child returned {}".format(retcode))
|
||||
|
||||
|
||||
def now():
|
||||
|
|
Ładowanie…
Reference in New Issue