From patchwork Fri Apr 9 15:34:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D10354: hg.bat: enable legacy I/O mode to fix missing pager output on Windows with py3 From: phabricator X-Patchwork-Id: 48671 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Fri, 9 Apr 2021 15:34:48 +0000 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 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.