def command(c):
log_normal(c)
- r = os.system(c)
- if (r >> 8):
- raise Error('command %s failed' % c)
+ try:
+ r = subprocess.run(c, shell=True)
+ if r.returncode != 0:
+ raise Error('command %s failed (%d)' % (c, r.returncode))
+ except Exception as e:
+ raise Error('command %s failed (%s)' % (c, e))
def command_and_read(c):
log_normal(c)