On Sun, 16 Dec 2018 00:55:20 -0500, Yuya Nishihara <y...@tcha.org> wrote:

On Sun, 16 Dec 2018 00:36:45 -0500, Matt Harbison wrote:
> I'm not sure what to do with this info yet, but I just noticed that
> pager is also messed up on py3- the debug message about spawning the
> pager prints, but no output for the diff. Use --pager=no, and it shows > up. So maybe there's a general problem with stdio of spawned children.

To be specific, this:

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1206,6 +1207,14 @@ class ui(object):
              pager.stdin.close()
              pager.wait()

+        try:
+           self.write('test output\n')
+           self.flush()
+        except Exception:
+            killpager()
+            self.traceback(force=True)
+            raise
+
          return True

      @property


Results in this:

$ py -3 ../hg diff -r .^^ --debug
*** failed to import extension evolve: No module named 'evolve'
obsolete feature not enabled but 177518 markers found!
starting pager for command 'diff'

Traceback (most recent call last):
   File "c:\Users\Matt\hg\mercurial\ui.py", line 1024, in _writenobuf
     color.win32print(self, dest.write, msg, **opts)
   File "c:\Users\Matt\hg\mercurial\color.py", line 528, in win32print
     writefunc(m.group(2))
   File "c:\Users\Matt\hg\mercurial\windows.py", line 202, in write
     self.fp.write(s[start:end])
OSError: [WinError 1] Incorrect function

That might be because the stdio files are backed by the Windows-ish type.
Can you try PYTHONLEGACYWINDOWSSTDIO=1?

https://www.python.org/dev/peps/pep-0528/

Python 3 shifted away from being Unix scripting language in many ways.

Yep, that fixed both pager and the strange server problems, thanks. I need more sleep before digesting that PEP, but skimming it seems to imply that we need to explicitly encode to stdio on Windows? How will that interact with the existing encoding functions?
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to