mercurial/utils/procutil.py
changeset 44867 8e8fd938ca07
parent 44812 79f6f856c53f
child 44950 f9734b2d59cc
equal deleted inserted replaced
44866:5258bffdb1d6 44867:8e8fd938ca07
    71 findexe = platform.findexe
    71 findexe = platform.findexe
    72 _gethgcmd = platform.gethgcmd
    72 _gethgcmd = platform.gethgcmd
    73 getuser = platform.getuser
    73 getuser = platform.getuser
    74 getpid = os.getpid
    74 getpid = os.getpid
    75 hidewindow = platform.hidewindow
    75 hidewindow = platform.hidewindow
    76 quotecommand = platform.quotecommand
       
    77 readpipe = platform.readpipe
    76 readpipe = platform.readpipe
    78 setbinary = platform.setbinary
    77 setbinary = platform.setbinary
    79 setsignalhandler = platform.setsignalhandler
    78 setsignalhandler = platform.setsignalhandler
    80 shellquote = platform.shellquote
    79 shellquote = platform.shellquote
    81 shellsplit = platform.shellsplit
    80 shellsplit = platform.shellsplit
   136     raise error.ProgrammingError(b'unsupported mode: %r' % mode)
   135     raise error.ProgrammingError(b'unsupported mode: %r' % mode)
   137 
   136 
   138 
   137 
   139 def _popenreader(cmd, bufsize):
   138 def _popenreader(cmd, bufsize):
   140     p = subprocess.Popen(
   139     p = subprocess.Popen(
   141         tonativestr(quotecommand(cmd)),
   140         tonativestr(cmd),
   142         shell=True,
   141         shell=True,
   143         bufsize=bufsize,
   142         bufsize=bufsize,
   144         close_fds=closefds,
   143         close_fds=closefds,
   145         stdout=subprocess.PIPE,
   144         stdout=subprocess.PIPE,
   146     )
   145     )
   147     return _pfile(p, p.stdout)
   146     return _pfile(p, p.stdout)
   148 
   147 
   149 
   148 
   150 def _popenwriter(cmd, bufsize):
   149 def _popenwriter(cmd, bufsize):
   151     p = subprocess.Popen(
   150     p = subprocess.Popen(
   152         tonativestr(quotecommand(cmd)),
   151         tonativestr(cmd),
   153         shell=True,
   152         shell=True,
   154         bufsize=bufsize,
   153         bufsize=bufsize,
   155         close_fds=closefds,
   154         close_fds=closefds,
   156         stdin=subprocess.PIPE,
   155         stdin=subprocess.PIPE,
   157     )
   156     )
   393     write() method. stdout and stderr will be redirected to out.'''
   392     write() method. stdout and stderr will be redirected to out.'''
   394     try:
   393     try:
   395         stdout.flush()
   394         stdout.flush()
   396     except Exception:
   395     except Exception:
   397         pass
   396         pass
   398     cmd = quotecommand(cmd)
       
   399     env = shellenviron(environ)
   397     env = shellenviron(environ)
   400     if out is None or isstdout(out):
   398     if out is None or isstdout(out):
   401         rc = subprocess.call(
   399         rc = subprocess.call(
   402             tonativestr(cmd),
   400             tonativestr(cmd),
   403             shell=True,
   401             shell=True,