MCPcopy Index your code
hub / github.com/RustPython/RustPython / _close_pipe_fds

Method _close_pipe_fds

Lib/subprocess.py:1296–1323  ·  view source on GitHub ↗
(self,
                        p2cread, p2cwrite,
                        c2pread, c2pwrite,
                        errread, errwrite)

Source from the content-addressed store, hash-verified

1294 raise # resume the KeyboardInterrupt
1295
1296 def _close_pipe_fds(self,
1297 p2cread, p2cwrite,
1298 c2pread, c2pwrite,
1299 errread, errwrite):
1300 # self._devnull is not always defined.
1301 devnull_fd = getattr(self, '_devnull', None)
1302
1303 with contextlib.ExitStack() as stack:
1304 if _mswindows:
1305 if p2cread != -1:
1306 stack.callback(p2cread.Close)
1307 if c2pwrite != -1:
1308 stack.callback(c2pwrite.Close)
1309 if errwrite != -1:
1310 stack.callback(errwrite.Close)
1311 else:
1312 if p2cread != -1 and p2cwrite != -1 and p2cread != devnull_fd:
1313 stack.callback(os.close, p2cread)
1314 if c2pwrite != -1 and c2pread != -1 and c2pwrite != devnull_fd:
1315 stack.callback(os.close, c2pwrite)
1316 if errwrite != -1 and errread != -1 and errwrite != devnull_fd:
1317 stack.callback(os.close, errwrite)
1318
1319 if devnull_fd is not None:
1320 stack.callback(os.close, devnull_fd)
1321
1322 # Prevent a double close of these handles/fds from __init__ on error.
1323 self._closed_child_pipe_fds = True
1324
1325 @contextlib.contextmanager
1326 def _on_error_fd_closer(self):

Callers 2

_execute_childMethod · 0.95
_posix_spawnMethod · 0.95

Calls 2

getattrFunction · 0.85
callbackMethod · 0.45

Tested by

no test coverage detected