Show More
@@ -16,25 +16,6 b' import unittest' | |||||
16 | from mercurial import pycompat, util |
|
16 | from mercurial import pycompat, util | |
17 |
|
17 | |||
18 |
|
18 | |||
19 | if pycompat.ispy3: |
|
|||
20 |
|
||||
21 | def set_noninheritable(fd): |
|
|||
22 | # On Python 3, file descriptors are non-inheritable by default. |
|
|||
23 | pass |
|
|||
24 |
|
||||
25 |
|
||||
26 | else: |
|
|||
27 | if pycompat.iswindows: |
|
|||
28 | # unused |
|
|||
29 | set_noninheritable = None |
|
|||
30 | else: |
|
|||
31 | import fcntl |
|
|||
32 |
|
||||
33 | def set_noninheritable(fd): |
|
|||
34 | old = fcntl.fcntl(fd, fcntl.F_GETFD) |
|
|||
35 | fcntl.fcntl(fd, fcntl.F_SETFD, old | fcntl.FD_CLOEXEC) |
|
|||
36 |
|
||||
37 |
|
||||
38 | TEST_BUFFERING_CHILD_SCRIPT = r''' |
|
19 | TEST_BUFFERING_CHILD_SCRIPT = r''' | |
39 | import os |
|
20 | import os | |
40 |
|
21 | |||
@@ -127,10 +108,6 b' def _devnull():' | |||||
127 | @contextlib.contextmanager |
|
108 | @contextlib.contextmanager | |
128 | def _pipes(): |
|
109 | def _pipes(): | |
129 | rwpair = os.pipe() |
|
110 | rwpair = os.pipe() | |
130 | # Pipes are already non-inheritable on Windows. |
|
|||
131 | if not pycompat.iswindows: |
|
|||
132 | set_noninheritable(rwpair[0]) |
|
|||
133 | set_noninheritable(rwpair[1]) |
|
|||
134 | with _closing(rwpair): |
|
111 | with _closing(rwpair): | |
135 | yield rwpair |
|
112 | yield rwpair | |
136 |
|
113 | |||
@@ -143,8 +120,6 b' def _ptys():' | |||||
143 | import tty |
|
120 | import tty | |
144 |
|
121 | |||
145 | rwpair = pty.openpty() |
|
122 | rwpair = pty.openpty() | |
146 | set_noninheritable(rwpair[0]) |
|
|||
147 | set_noninheritable(rwpair[1]) |
|
|||
148 | with _closing(rwpair): |
|
123 | with _closing(rwpair): | |
149 | tty.setraw(rwpair[0]) |
|
124 | tty.setraw(rwpair[0]) | |
150 | yield rwpair |
|
125 | yield rwpair |
General Comments 0
You need to be logged in to leave comments.
Login now