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

Function waitpid

crates/vm/src/stdlib/nt.rs:945–956  ·  view source on GitHub ↗
(pid: intptr_t, opt: i32, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

943 #[cfg(target_env = "msvc")]
944 #[pyfunction]
945 fn waitpid(pid: intptr_t, opt: i32, vm: &VirtualMachine) -> PyResult<(intptr_t, u64)> {
946 let mut status: i32 = 0;
947 let pid = unsafe { suppress_iph!(_cwait(&mut status, pid, opt)) };
948 if pid == -1 {
949 Err(vm.new_last_errno_error())
950 } else {
951 // Cast to unsigned to handle large exit codes (like 0xC000013A)
952 // then shift left by 8 to match POSIX waitpid format
953 let ustatus = (status as u32) as u64;
954 Ok((pid, ustatus << 8))
955 }
956 }
957
958 #[cfg(target_env = "msvc")]
959 #[pyfunction]

Callers 3

waitFunction · 0.70
_spawnvefFunction · 0.50
_stop_lockedMethod · 0.50

Calls 2

new_last_errno_errorMethod · 0.80
ErrClass · 0.50

Tested by

no test coverage detected