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

Method _execute_child

Lib/subprocess.py:1450–1575  ·  view source on GitHub ↗

Execute program (MS Windows version)

(self, args, executable, preexec_fn, close_fds,
                           pass_fds, cwd, env,
                           startupinfo, creationflags, shell,
                           p2cread, p2cwrite,
                           c2pread, c2pwrite,
                           errread, errwrite,
                           unused_restore_signals,
                           unused_gid, unused_gids, unused_uid,
                           unused_umask,
                           unused_start_new_session, unused_process_group)

Source from the content-addressed store, hash-verified

1448
1449
1450 def _execute_child(self, args, executable, preexec_fn, close_fds,
1451 pass_fds, cwd, env,
1452 startupinfo, creationflags, shell,
1453 p2cread, p2cwrite,
1454 c2pread, c2pwrite,
1455 errread, errwrite,
1456 unused_restore_signals,
1457 unused_gid, unused_gids, unused_uid,
1458 unused_umask,
1459 unused_start_new_session, unused_process_group):
1460 """Execute program (MS Windows version)"""
1461
1462 assert not pass_fds, "pass_fds not supported on Windows."
1463
1464 if isinstance(args, str):
1465 pass
1466 elif isinstance(args, bytes):
1467 if shell:
1468 raise TypeError('bytes args is not allowed on Windows')
1469 args = list2cmdline([args])
1470 elif isinstance(args, os.PathLike):
1471 if shell:
1472 raise TypeError('path-like args is not allowed when '
1473 'shell is true')
1474 args = list2cmdline([args])
1475 else:
1476 args = list2cmdline(args)
1477
1478 if executable is not None:
1479 executable = os.fsdecode(executable)
1480
1481 # Process startup details
1482 if startupinfo is None:
1483 startupinfo = STARTUPINFO()
1484 else:
1485 # bpo-34044: Copy STARTUPINFO since it is modified above,
1486 # so the caller can reuse it multiple times.
1487 startupinfo = startupinfo.copy()
1488
1489 use_std_handles = -1 not in (p2cread, c2pwrite, errwrite)
1490 if use_std_handles:
1491 startupinfo.dwFlags |= _winapi.STARTF_USESTDHANDLES
1492 startupinfo.hStdInput = p2cread
1493 startupinfo.hStdOutput = c2pwrite
1494 startupinfo.hStdError = errwrite
1495
1496 attribute_list = startupinfo.lpAttributeList
1497 have_handle_list = bool(attribute_list and
1498 "handle_list" in attribute_list and
1499 attribute_list["handle_list"])
1500
1501 # If we were given an handle_list or need to create one
1502 if have_handle_list or (use_std_handles and close_fds):
1503 if attribute_list is None:
1504 attribute_list = startupinfo.lpAttributeList = {}
1505 handle_list = attribute_list["handle_list"] = \
1506 list(attribute_list.get("handle_list", []))
1507

Callers 1

__init__Method · 0.95

Calls 15

copyMethod · 0.95
_filter_handle_listMethod · 0.95
_close_pipe_fdsMethod · 0.95
_posix_spawnMethod · 0.95
_handle_exitstatusMethod · 0.95
isinstanceFunction · 0.85
list2cmdlineFunction · 0.85
STARTUPINFOClass · 0.85
listClass · 0.85
hasattrFunction · 0.85
setFunction · 0.85
sortedFunction · 0.85

Tested by

no test coverage detected