title: Mercurial 1.5 pager on Windows
body: <p>I'm trying to set the pager used for Mercurial but the output is empty, even if I specify the command in the <code>[pager]</code> section or as the <code>PAGER</code> environment variable.</p>
  
  <p>I noticed that the command provided is launched with <code>cmd.exe</code>. Is this the cause of empty output, and if yes, what is the right syntax?</p>
  
  <p>Environment: Mercurial 1.5, Mercurial 1.4.3</p>
  
  <p>hgrc:</p>
  
  <pre><code>[extensions]
  pager =
  
  [pager]
  pager = d:\tools\less\less.exe
  </code></pre>
  
  <p>Sample command lines (from Process Explorer):</p>
  
  <pre><code>hg diff
  c:\windows\system32\cmd.exe /c "d:\tools\less\less.exe 2&gt; NUL:"
  d:\tools\less\less.exe
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>In pager.py, by replacing:</p>
  
  <pre><code>sys.stderr = sys.stdout = util.popen(p, "wb")
  </code></pre>
  
  <p>with</p>
  
  <pre><code>sys.stderr = sys.stdout = subprocess.Popen(p, stdin = subprocess.PIPE, shell=False).stdin
  </code></pre>
  
  <p>I managed to obtain the desired output for the hg status and diff.</p>
  
  <p>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.</p>
  
  <p>Also, it makes no difference what I'm choosing as a pager app (more is behaving the same). </p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p><a href="https://bz.mercurial-scm.org/show_bug.cgi?id=1677" rel="nofollow noreferrer"><strong>Issue1677 - [PATCH] pager for "hg help" output on windows</strong></a></p>