def shell_process(cmds, env=None, **kwds):
 sys = kwds.get('sys', _sys)
 popen_kwds = dict(shell=True)
 if ((kwds.get('stdout', None) is None) and redirecting_io(sys=sys)):
  popen_kwds['stdout'] = subprocess.PIPE
 if ((kwds.get('stderr', None) is None) and redirecting_io(sys=sys)):
  popen_kwds['stderr'] = subprocess.PIPE
 popen_kwds.update(**kwds)
 if env:
  new_env = os.environ.copy()
  new_env.update(env)
  popen_kwds['env'] = new_env
 p = subprocess.Popen(cmds, **popen_kwds)
 return p

def shell_process ( cmds , env = None , ** kwds ) : sys = kwds . get ( 'sys' , _sys ) popen_kwds = dict ( shell = True ) if ( ( kwds . get ( 'stdout' , None ) is None ) and redirecting_io ( sys = sys ) ) : popen_kwds [ 'stdout' ] = subprocess . PIPE if ( ( kwds . get ( 'stderr' , None ) is None ) and redirecting_io ( sys = sys ) ) : popen_kwds [ 'stderr' ] = subprocess . PIPE popen_kwds . update ( ** kwds ) if env : new_env = os . environ . copy ( ) new_env . update ( env ) popen_kwds [ 'env' ] = new_env p = subprocess . Popen ( cmds , ** popen_kwds ) return p
a high-level method wrapping subprocess .