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

Matt Harbison mharbison72 at gmail.com
Fri Mar 24 20:16:30 EDT 2017


On Fri, 24 Mar 2017 10:17:46 -0400, Yuya Nishihara <yuya at tcha.org> wrote:

> On Thu, 23 Mar 2017 21:57:50 -0400, Matt Harbison wrote:
>> # HG changeset patch
>> # User Matt Harbison <matt_harbison at yahoo.com>
>> # Date 1489983573 14400
>> #      Mon Mar 20 00:19:33 2017 -0400
>> # Node ID d0c2db2d9f13dca534c598de050eb1919ef79059
>> # Parent  df82f375fa005b9c71b463182e6b54aa47fa5999
>> pager: fix the invocation of `more` on Windows
>
>> diff --git a/mercurial/ui.py b/mercurial/ui.py
>> --- a/mercurial/ui.py
>> +++ b/mercurial/ui.py
>> @@ -844,6 +844,15 @@
>>          if not pagercmd:
>>              return
>>
>> +        if pycompat.osname == 'nt':
>> +            # `more` cannot be invoked with shell=False, but  
>> `more.com` can.
>> +            # Hide this implementation detail from the user, so we can  
>> also get
>> +            # sane bad PAGER behavior.  If args are also given, the  
>> space in the
>> +            # command line forces shell=True, so that case doesn't  
>> need to be
>> +            # handled here.
>> +            if pagercmd == 'more':
>> +                pagercmd = 'more.com'
>
> Given MSYS nor MSYS2 doesn't provide more.exe by default, this seems  
> fine.
> Can we document this hack in help just in case someone installed  
> more.exe?

I know this is an edge case, but instead of documenting how a user can't  
just say 'more' and spawn 'more.exe', what do you think about calling  
util.findexe() if pagercmd == 'more'?  That finds 'more.com' too, so  
things should just work as if they were in cmd.exe.
 


More information about the Mercurial-devel mailing list