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

Function exec

crates/stdlib/src/posixsubprocess.rs:238–254  ·  view source on GitHub ↗
(args: &ForkExecArgs<'_>, procargs: ProcArgs<'_>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

236}
237
238fn exec(args: &ForkExecArgs<'_>, procargs: ProcArgs<'_>, vm: &VirtualMachine) -> ! {
239 let mut ctx = ExecErrorContext::NoExec;
240 match exec_inner(args, procargs, &mut ctx, vm) {
241 Ok(x) => match x {},
242 Err(e) => {
243 let mut pipe = args.errpipe_write;
244 if matches!(ctx, ExecErrorContext::PreExec) {
245 // For preexec_fn errors, use SubprocessError format (errno=0)
246 let _ = write!(pipe, "SubprocessError:0:{}", ctx.as_msg());
247 } else {
248 // errno is written in hex format
249 let _ = write!(pipe, "OSError:{:x}:{}", e as i32, ctx.as_msg());
250 }
251 std::process::exit(255)
252 }
253 }
254}
255
256enum ExecErrorContext {
257 NoExec,

Callers 1

fork_execFunction · 0.70

Calls 2

exec_innerFunction · 0.85
exitFunction · 0.50

Tested by

no test coverage detected