Patchwork D10354: hg.bat: enable legacy I/O mode to fix missing pager output on Windows with py3

login
register
mail settings
Submitter phabricator
Date April 9, 2021, 3:34 p.m.
Message ID <differential-rev-PHID-DREV-jc2g5pdy4vd6p5h7z5pi-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48671/
State Superseded
Headers show

Comments

phabricator - April 9, 2021, 3:34 p.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The equivalent interpreter option is set by wrapper.exe, but this *.bat file is
  what gets installed in a venv.  Without this mode, any command that spins up a
  pager has no output, unless the pager is explicitly disabled.  The variable is
  set inside the `setlocal` scope to keep it from leaking into the environment
  after the bat file exits.
  
  We should probably still figure out how to ship a compiled hg.exe when
  installing with `pip`, because the binary does other things like enable long
  filename support.  But this avoids the dangerous and confusing lack of output in
  the meantime.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10354

AFFECTED FILES
  contrib/win32/hg.bat

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/contrib/win32/hg.bat b/contrib/win32/hg.bat
--- a/contrib/win32/hg.bat
+++ b/contrib/win32/hg.bat
@@ -4,6 +4,8 @@ 
 setlocal
 set HG=%~f0
 
+set PYTHONLEGACYWINDOWSSTDIO=1

+

 rem Use a full path to Python (relative to this script) if it exists,
 rem as the standard Python install does not put python.exe on the PATH...
 rem Otherwise, expect that python.exe can be found on the PATH.