def finish_subprocess(proc, cmdline, ok_exit_codes=None):
 if (ok_exit_codes is None):
  ok_exit_codes = [0]
 (out, err) = proc.communicate()
 ret = proc.returncode
 if (ret not in ok_exit_codes):
  raise Exception(("'%(cmdline)s' returned non-zero exit code: retcode=%(ret)i, out='%(out)s', stderr='%(err)s'" % locals()))
 return (out, err)

def finish_subprocess ( proc , cmdline , ok_exit_codes = None ) : if ( ok_exit_codes is None ) : ok_exit_codes = [ 0 ] ( out , err ) = proc . communicate ( ) ret = proc . returncode if ( ret not in ok_exit_codes ) : raise Exception ( ( "'%(cmdline)s' returned non-zero exit code: retcode=%(ret)i, out='%(out)s', stderr='%(err)s'" % locals ( ) ) ) return ( out , err )
ensure that the process returned a zero exit code indicating success .