Skip to main content

execcmd_fork

Function execcmd_fork 

Source
pub fn execcmd_fork(
    state: &mut estate,
    how: i32,
    typ: i32,
    varspc: Option<usize>,
    filelistp: &mut Vec<jobfile>,
    text: &str,
    oautocont: i32,
    close_if_forked: i32,
) -> i32
Expand description

Port of execcmd_fork(Estate state, int how, int type, Wordcode varspc, LinkList *filelistp, char *text, int oautocont, int close_if_forked) from Src/exec.c:2810-2893.

Fork the current command into a child process: parent records the pid + STTY env scan + addproc; child enters subshell, writes entersubsh_ret back to parent through synch pipe, and returns 0 so the caller can continue with the body.

filelistp out-arg is moved from jobtab[thisjob].filelist only in the child branch (so the parent’s filelist stays untouched). Rust sig keeps the same C contract.