Commit 32063456 authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Add raise_error option to run_commandline

parent 2b3a7b01
...@@ -188,7 +188,7 @@ def compute_pstar(twoFcheck_obs, twoFstarcheck_obs, m0, plot=False): ...@@ -188,7 +188,7 @@ def compute_pstar(twoFcheck_obs, twoFstarcheck_obs, m0, plot=False):
return 2*np.min([pstar_l, 1-pstar_l]) return 2*np.min([pstar_l, 1-pstar_l])
def run_commandline(cl, log_level=20): def run_commandline(cl, log_level=20, raise_error=True):
"""Run a string cmd as a subprocess, check for errors and return output. """Run a string cmd as a subprocess, check for errors and return output.
Parameters Parameters
...@@ -211,7 +211,10 @@ def run_commandline(cl, log_level=20): ...@@ -211,7 +211,10 @@ def run_commandline(cl, log_level=20):
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
logging.error('Execution failed:') logging.error('Execution failed:')
logging.error(e.output) logging.error(e.output)
raise if raise_error:
raise
else:
out = 0
os.system('\n') os.system('\n')
return(out) return(out)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment