Mercurial 1.5 pager on Windows
Posted
by alexandrul
on Stack Overflow
See other posts from Stack Overflow
or by alexandrul
Published on 2010-03-04T10:46:02Z
Indexed on
2010/03/12
13:27 UTC
Read the original article
Hit count: 437
I'm trying to set the pager used for Mercurial but the output is empty, even if I specify the command in the [pager]
section or as the PAGER
environment variable.
I noticed that the command provided is launched with cmd.exe
. Is this the cause of empty output, and if yes, what is the right syntax?
Environment: Mercurial 1.5, Mecurial 1.4.3
hgrc:
[extensions]
pager =
[pager]
pager = d:\tools\less\less.exe
Sample command lines (from Process Explorer):
hg diff
c:\windows\system32\cmd.exe /c "d:\tools\less\less.exe 2> NUL:"
d:\tools\less\less.exe
UPDATE
In pager.py, by replacing:
sys.stderr = sys.stdout = util.popen(p, "wb")
with
sys.stderr = sys.stdout = subprocess.Popen(p, stdin = subprocess.PIPE, shell=False).stdin
I managed to obtain the desired output for the hg status and diff.
BUT, I'm sure it's wrong (or at least incomplete), and I have no control over the pager app (less.exe): the output is shown in the cmd.exe window, I can see the less prompt (:) but any further input is fed into cmd.exe. It seems that the pager app is still active in the background: after typing exit in the cmd.exe window, I have control over the pager app, and I can terminate it normally.
Also, it makes no difference what I'm choosing as a pager app (more is behaving the same).
UPDATE 2
© Stack Overflow or respective owner