comparison 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
comparison
equal deleted inserted replaced
46174:a1601ff3877c 46175:a04c03b0678e
47 47
48 $ hg status ENOENT 2>/dev/full 48 $ hg status ENOENT 2>/dev/full
49 [255] 49 [255]
50 #endif 50 #endif
51 51
52 On Python 3, stdio may be None:
53
54 $ hg debuguiprompt --config ui.interactive=true 0<&-
55 abort: Bad file descriptor
56 [255]
57 $ hg version -q 0<&-
58 Mercurial Distributed SCM * (glob)
59
60 #if py3
61 $ hg version -q 1>&-
62 abort: Bad file descriptor
63 [255]
64 #else
65 $ hg version -q 1>&-
66 #endif
67 $ hg unknown -q 1>&-
68 hg: unknown command 'unknown'
69 (did you mean debugknown?)
70 [255]
71
72 $ hg version -q 2>&-
73 Mercurial Distributed SCM * (glob)
74 $ hg unknown -q 2>&-
75 [255]
76
52 $ hg commit -m test 77 $ hg commit -m test
53 78
54 This command is ancient: 79 This command is ancient:
55 80
56 $ hg history 81 $ hg history