diff tests/test-basic.t @ 46175:a04c03b0678e

procutil: assign pseudo file object if sys.stdout/stderr is missing This basically simulates the Python 2 behavior. If libc stdio were used, these file objects would be available and raise EBADF. There is subtle difference between py2 and py3, but I think py3 behavior (i.e. exit 255) is more correct. "if" conditions are adjust so that they look similar to dispatch.initstdio().
author Yuya Nishihara <yuya@tcha.org>
date Fri, 18 Dec 2020 20:09:11 +0900
parents f44b9c72f061
children 9c9e0b4b2ca7
line wrap: on
line diff
--- a/tests/test-basic.t	Sat Dec 19 11:10:18 2020 +0900
+++ b/tests/test-basic.t	Fri Dec 18 20:09:11 2020 +0900
@@ -49,6 +49,31 @@
   [255]
 #endif
 
+On Python 3, stdio may be None:
+
+  $ hg debuguiprompt --config ui.interactive=true 0<&-
+   abort: Bad file descriptor
+  [255]
+  $ hg version -q 0<&-
+  Mercurial Distributed SCM * (glob)
+
+#if py3
+  $ hg version -q 1>&-
+  abort: Bad file descriptor
+  [255]
+#else
+  $ hg version -q 1>&-
+#endif
+  $ hg unknown -q 1>&-
+  hg: unknown command 'unknown'
+  (did you mean debugknown?)
+  [255]
+
+  $ hg version -q 2>&-
+  Mercurial Distributed SCM * (glob)
+  $ hg unknown -q 2>&-
+  [255]
+
   $ hg commit -m test
 
 This command is ancient: