Skip to content
ProcReadFromStderr

ProcReadFromStderr

Description

Blocking read from the child’s stderr into buf (appended).

Success

Returns the number of bytes appended to buf (>= 0). Zero indicates EOF on the pipe.

Failure

Returns -1. Any bytes read before the failing read are still appended to buf (drain is incremental, not transactional); the failure cause is logged.

Usage example (Cross-references)

Usage examples (Cross-references)
        do {                                                                                                               \
            Str UNPL(buf) = StrInit();                                                                                     \
            ProcReadFromStderr((p), &UNPL(buf));                                                                           \
            Zstr UNPL(in) = StrBegin(&UNPL(buf));                                                                          \
            StrReadFmt(UNPL(in), __VA_ARGS__);                                                                             \
    }
    
    i32 ProcReadFromStderr(Proc *proc, Str *buf) {
        return proc_read_internal(proc, buf, /* is stdout*/ false);
    }
Last updated on