[PATCH] py3: partially fix pager spawning on Windows

Yuya Nishihara yuya at tcha.org
Sun Sep 16 11:26:35 EDT 2018


On Sun, 16 Sep 2018 09:21:46 -0400, Matt Harbison wrote:
> 
> > On Sep 16, 2018, at 2:41 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> > 
> >> On Sun, 16 Sep 2018 00:40:37 -0400, Matt Harbison wrote:
> >> # HG changeset patch
> >> # User Matt Harbison <matt_harbison at yahoo.com>
> >> # Date 1537032701 14400
> >> #      Sat Sep 15 13:31:41 2018 -0400
> >> # Node ID efffacd34255117920417dfb2d71627929499500
> >> # Parent  87539f615b878fe39973fb059b0531fa4fd7e6ff
> >> py3: partially fix pager spawning on Windows
> 
> Any thoughts on how the invalid handle came to be?

Not really.

Is the pager process alive if you do sleep(10) for example?

> >>         try:
> >>             pager = subprocess.Popen(
> >> -                command, shell=shell, bufsize=-1,
> >> +                encoding.strfromlocal(command), shell=shell, bufsize=-1,
> > 
> > Do that only on Windows.
> 
> Is making a platform specific wrapper for this and the other functions that spawn processes reasonable?  Then there won’t be ugly conditionals and either local variables of Unicode or copy/paste all over. That would help the issue below too.

Could be.

  # procutil.py
  if pycompat.iswindows:
      tonativestr = pycompat.strfromlocal
  else:
      tonativestr = pycompat.identity

  def tonativeenv(env):
      return pycompat.rapply(tonativestr, env)


More information about the Mercurial-devel mailing list