How to get output of piped process?

kdevel kdevel at vogtner.de
Fri Feb 19 10:41:53 UTC 2021


On Friday, 19 February 2021 at 08:37:50 UTC, Imperatorn wrote:
> Does your iopipe handle... Pipes? 😀

BTW: What about SIGPIPE?

In an experimental code I have this

    :
    fout.rawWrite (buf);
    fout.rawWrite ("\n");
    writeln ("flushing");
    fout.flush ();                                    // (a)
    enforce (! fout.eof, "eof on write to child");    // (b)
    writeln ("reading from pipe");
    :

fout actually is the child's stdin. Sometimes between (a) and (b)
a SIGPIPE occurs and terminates the process (exit code 141). That
prevents the proper handling of eof.

Why isn't SIGPIPE blocked or handled by default?


More information about the Digitalmars-d-learn mailing list