Show More
@@ -22,12 +22,14 b' def explain_exit(code):' | |||||
22 | return "stopped by signal %d" % val, val |
|
22 | return "stopped by signal %d" % val, val | |
23 | raise ValueError("invalid exit code") |
|
23 | raise ValueError("invalid exit code") | |
24 |
|
24 | |||
25 |
def system(cmd, errprefix |
|
25 | def system(cmd, errprefix=None): | |
26 | """execute a shell command that must succeed""" |
|
26 | """execute a shell command that must succeed""" | |
27 | rc = os.system(cmd) |
|
27 | rc = os.system(cmd) | |
28 | if rc: |
|
28 | if rc: | |
29 |
errmsg = "%s |
|
29 | errmsg = "%s %s" % (os.path.basename(cmd.split(None, 1)[0]), | |
30 |
|
|
30 | explain_exit(rc)[0]) | |
|
31 | if errprefix: | |||
|
32 | errmsg = "%s: %s" % (errprefix, errmsg) | |||
31 | raise CommandError(errmsg) |
|
33 | raise CommandError(errmsg) | |
32 |
|
34 | |||
33 | def rename(src, dst): |
|
35 | def rename(src, dst): |
General Comments 0
You need to be logged in to leave comments.
Login now