Skip to main content

spawnpipes

Function spawnpipes 

Source
pub fn spawnpipes(l: &mut [redir], nullexec: i32)
Expand description

Port of static void spawnpipes(LinkList l, int nullexec) from Src/exec.c:5184.

Walks a redir list l, and for each REDIR_OUTPIPE/REDIR_INPIPE entry fires getpipe(name, nullexec || varid) and stashes the resulting fd into f->fd2.

LinkNode n;
Redir f;
char *str;
n = firstnode(l);
for (; n; incnode(n)) {
    f = (Redir) getdata(n);
    if (f->type == REDIR_OUTPIPE || f->type == REDIR_INPIPE) {
        str = f->name;
        f->fd2 = getpipe(str, nullexec || f->varid);
    }
}