def check_run_and_monitor(command, echo=True, input=None):
 result = run_and_monitor(command, echo=echo, input=input)
 if (result.returncode != 0):
  error = 'FAILED {command} with exit code {code}\n{err}'.format(command=command, code=result.returncode, err=result.stderr.strip())
  sys.stderr.write((error + '\n'))
  raise RuntimeError(error)
 return result

def check_run_and_monitor ( command , echo = True , input = None ) : result = run_and_monitor ( command , echo = echo , input = input ) if ( result . returncode != 0 ) : error = 'FAILED {command} with exit code {code}\n{err}' . format ( command = command , code = result . returncode , err = result . stderr . strip ( ) ) sys . stderr . write ( ( error + '\n' ) ) raise RuntimeError ( error ) return result
runs the command in a subshell and throws an exception if it fails .