Skip to main content

getproc

Function getproc 

Source
pub fn getproc(cmd: &str, eptr: Option<&mut usize>) -> Option<String>
Expand description

Port of char *getproc(char *cmd, char **eptr) from Src/exec.c:5025<(cmd) / >(cmd) process substitution via /dev/fd/N (PATH_DEV_FD branch; modern Linux/macOS).

(a) PATH_DEV_FD branch only — the FIFO fallback (!PATH_DEV_FD path c:5037-5064) is omitted; modern Linux/macOS both provide /dev/fd. namedpipe() is ported (exec.rs:2701) but unused here. (b) addproc is 7-arg; procsubst pid recorded via aux=true on the current job (c:5141-5142). (c) addfilelist(NULL, fd) wired via JOBTAB[thisjob] at c:5087. (d) entersubsh is ported at exec.rs:3934 — wired below at c:5063 (entersubsh(ESUB_ASYNC|ESUB_PGRP, NULL)). (e) execode is ported at exec.rs:6047. Body still re-feeds through fusevm for cache coherence. (f) _realexit flushes stdio + jobs + history. We use bare std::process::exit(LASTVAL) for now. (g) fdtable[fd] = FDT_PROC_SUBST (c:5086) — set via fdtable_set.