> On Sep 16, 2018, at 2:41 AM, Yuya Nishihara <y...@tcha.org> wrote:
> 
>> 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

Any thoughts on how the invalid handle came to be?

>> # 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.

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.

>> 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

Reply via email to