On Mon, 09 Dec 2019 18:57:18 -0500, Tom Hindle <[email protected]> wrote:

On 12/2/19 8:33 PM, Matt Harbison wrote:
One word of caution, you need to run `hg.exe`, not `hg`. I'm not sure what's going on (I suspect it's at least in part because the legacy stdio environment variable isn't set), but you won't get any output from the latter.

Thanks for the warning! I am seeing stdout not giving output when running hg.exe as well. (using python 3.8) (perhaps I did something wrong in the build and PYTHONLEGACYWINDOWSSTDIO isn't set in my hg.exe?)

I see in ui._runpager: (mercurial/ui.py)

that:

os.dup2(pager.stdin.fileno(), procutil.stdout.fileno())

and this SO question and python doc explains to me why this causes a problem:

https://stackoverflow.com/questions/52373180/python-on-windows-handle-invalid-when-redirecting-stdout-writing-to-file

https://docs.python.org/3/library/sys.html


But setting the following fixes running both 'hg.exe' + 'python.exe hg'

set PYTHONLEGACYWINDOWSSTDIO=1

There's a exewrapper.c in the codebase that gets compiled into hg.exe that sets this internally when building against py3. So I doubt you screwed anything up. I looked at updating setup.py to not create the usual executables when building (because I think *they* are the problem), and use that hg.exe instead. But I wasn't having a lot of luck with it and gave up. Setting that environment variable should be good enough for now for your testing.
_______________________________________________
Mercurial mailing list
[email protected]
https://www.mercurial-scm.org/mailman/listinfo/mercurial

Reply via email to