Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gregory Ashton
PyFstat
Commits
32063456
Commit
32063456
authored
Aug 02, 2017
by
Gregory Ashton
Browse files
Add raise_error option to run_commandline
parent
2b3a7b01
Changes
1
Hide whitespace changes
Inline
Side-by-side
pyfstat/helper_functions.py
View file @
32063456
...
...
@@ -188,7 +188,7 @@ def compute_pstar(twoFcheck_obs, twoFstarcheck_obs, m0, plot=False):
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.
Parameters
...
...
@@ -211,7 +211,10 @@ def run_commandline(cl, log_level=20):
except
subprocess
.
CalledProcessError
as
e
:
logging
.
error
(
'Execution failed:'
)
logging
.
error
(
e
.
output
)
raise
if
raise_error
:
raise
else
:
out
=
0
os
.
system
(
'
\n
'
)
return
(
out
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment