projects
/
cdist.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e59e21f
)
Replace os.system with subprocess.run so that it's easier to report errors correctly...
author
Carl Hetherington
<cth@carlh.net>
Fri, 20 Nov 2020 11:05:42 +0000
(12:05 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Fri, 20 Nov 2020 11:05:42 +0000
(12:05 +0100)
cdist
patch
|
blob
|
history
diff --git
a/cdist
b/cdist
index 6011338daadae41f5479b405f8fb9fc168d785be..c9f15a0c79637afe9942ab79ad40a8d3009b2f82 100755
(executable)
--- a/
cdist
+++ b/
cdist
@@
-256,9
+256,12
@@
def rmtree(a):
def command(c):
log_normal(c)
- r = os.system(c)
- if (r >> 8):
- raise Error('command %s failed' % c)
+ try:
+ r = subprocess.run(shlex.split(c))
+ if r.returncode != 0:
+ raise Error(f'command {c} failed ({r.returncode})')
+ except Exception as e:
+ raise Error(f'command {c} failed ({e})')
def command_and_read(c):
log_normal(c)