On Sun, 16 Sep 2018 00:40:37 -0400, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison <matt_harbi...@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
> diff --git a/mercurial/encoding.py b/mercurial/encoding.py > --- a/mercurial/encoding.py > +++ b/mercurial/encoding.py > @@ -233,6 +233,14 @@ if not _nativeenviron: > environ = dict((tolocal(k.encode(u'utf-8')), tolocal(v.encode(u'utf-8'))) > for k, v in os.environ.items()) # re-exports > > + def tonativeenv(env): > + return { > + strfromlocal(k): strfromlocal(v) for k, v in env.items() > + } > +else: > + def tonativeenv(env): > + return env Can you move this to procutil? And pycompat.rapply() might be useful as it has a fast path for strfromlocal == identity. > # How to treat ambiguous-width characters. Set to 'wide' to treat as wide. > _wide = _sysstr(environ.get("HGENCODINGAMBIGUOUS", "narrow") == "wide" > and "WFA" or "WF") > diff --git a/mercurial/ui.py b/mercurial/ui.py > --- a/mercurial/ui.py > +++ b/mercurial/ui.py > @@ -1130,7 +1130,7 @@ class ui(object): > > try: > pager = subprocess.Popen( > - command, shell=shell, bufsize=-1, > + encoding.strfromlocal(command), shell=shell, bufsize=-1, Do that only on Windows. > diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py > --- a/mercurial/utils/procutil.py > +++ b/mercurial/utils/procutil.py > @@ -315,7 +315,8 @@ def shellenviron(environ=None): > if environ: > env.update((k, py2shell(v)) for k, v in environ.iteritems()) > env['HG'] = hgexecutable() > - return env > + > + return encoding.tonativeenv(env) I think it's better to leave this to callers. Mixing unicode and bytes APIs is a source of bugs. _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel