[PATCH 1 of 3] pager: fix the invocation of `more` on Windows

Matt Harbison mharbison72 at gmail.com
Tue Mar 21 20:25:02 EDT 2017


On Tue, 21 Mar 2017 17:40:58 -0400, Jun Wu <quark at fb.com> wrote:

> Excerpts from Augie Fackler's message of 2017-03-21 17:34:39 -0400:
>> On Mon, Mar 20, 2017 at 12:53:17AM -0400, Matt Harbison wrote:
>> > pager: fix the invocation of `more` on Windows
>>
>> I've taken this one. And I'm sad.
>>
>> (Thanks! I blame windows for the sadness, not you.)
>
> This does not look like a complete fix. Users setting  
> "pager.pager=more", or
> "pager.pager=somethingelse" will still have issues.

You're correct about the former, but I don't understand the latter.  It  
seems like *.com is the issue (I'm guessing cmd.exe handles it special,  
based on $PATHEXT).  I tried with pager.pager=notepad, and  
pager.pager=C:\Progra~2\GnuWin32\bin\less, and it had no problem invoking  
either *.exe without the extension.

> A better fix seems to be disable shell=False for Windows.

I dunno.  If shell=True, you get a cryptic error and nothing else with a  
bad pager.  If shell=False, a bad pager is simply disabled with a warning,  
and normal output.  That seems more friendly.

Since I think we are in agreement that there will be a special case here  
in _some_ form, what I should have done is to translate more -> more.com  
*after* getting the config on Windows, instead of setting the default  
value.  I doubt there are any other *.com pagers, and I don't think anyone  
is trying to page through a *.bat file or anything like that.  (And if  
they want to do something crazy with these odd "executables",  
pager.pager="cmd.exe /c more" worked for me, so I assume it works for  
*.bat, etc.)  IDK how many Windows users would even bother to configure  
`more`, but we should be able to make it work.

I'll send V2 tomorrow, if there aren't any other comments before then.

>> >
>> > After 9335dc6b2a9c, invoking `more` no longer works.  Instead, a  
>> warning is
>> > printed and the pager is disabled.  Invoking `more.com` works.


More information about the Mercurial-devel mailing list