Skip to content

Commit

Permalink
raise exception on any non-zero exit code from subprocesses (#492)
Browse files Browse the repository at this point in the history
* raise exception on any non-zero exit code from subprocesses
Co-authored-by: abelsonlive <[email protected]>
  • Loading branch information
Emmett Butler authored Jan 10, 2022
1 parent fb8ce9c commit 95cb598
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions streamparse/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,12 @@ def set_topology_serializer(env_config, config, topology_class):

def run_cmd(cmd, user, **kwargs):
with show("everything"):
return (
run(cmd, **kwargs) if user == env.user else sudo(cmd, user=user, **kwargs)
)
with settings(warn_only=True):
command_result = (
run(cmd, **kwargs)
if user == env.user
else sudo(cmd, user=user, **kwargs)
)
if command_result.return_code != 0:
raise RuntimeError('Command failed to run: %s' % cmd)
return command_result
2 changes: 1 addition & 1 deletion streamparse/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ def _safe_int(string):
return string


__version__ = "4.1.1"
__version__ = "4.1.2"
VERSION = tuple(_safe_int(x) for x in __version__.split("."))

0 comments on commit 95cb598

Please sign in to comment.