pub fn readoutput(in_fd: i32, qt: i32, readerror: &mut i32) -> Vec<String>Expand description
Port of Eprog parsecmd(char *cmd, char **eptr) from Src/exec.c:4878.
C body:
char *str;
Eprog prog;
for (str = cmd + 2; *str && *str != Outpar; str++);
if (!*str || cmd[1] != Inpar) {
char *errstr = dupstrpfx(cmd, 2);
untokenize(errstr);
zerr("unterminated `%s...)'", errstr);
return NULL;
}
*str = '\0';
if (eptr) *eptr = str+1;
if (!(prog = parse_string(cmd + 2, 0))) {
zerr("parse error in process substitution");
return NULL;
}
return prog;Port of static LinkList readoutput(int in, int qt, int *readerror)
from Src/exec.c:4805. Drain a command-substitution pipe fd and
return the captured output split per qt.
qt=1 (quoted-substitution "$(...)"): single-element vec with
the trailing-newline-trimmed buffer (empty buffer → Nularg sentinel
per c:4861).
qt=0 (unquoted $(...)): split on IFS via spacesplit; if
GLOBSUBST is set, each word is shtokenized for downstream globbing.
readerror is set to the errno on read failure, 0 on clean EOF.