How to get output of piped process?

kdevel kdevel at vogtner.de
Fri Feb 19 15:39:25 UTC 2021


On Friday, 19 February 2021 at 13:42:46 UTC, Steven Schveighoffer 
wrote:

[...]

> ignoring SIGPIPE is a process-wide thing, and so it's not 
> appropriate for Phobos to make that decision for you. But it's 
> trivial to ignore it.

Sure.

> I've never been a fan of SIGPIPE. If you look around on the 
> Internet, you'll find that most people agree that the reasoning 
> for SIGPIPE is to fix poor programming (i.e. ignoring of error 
> codes).

As application programmer I don't want to check any error codes.
Thankfully I don't have to in D. There is a nice off-topic example
from the linux kernel [1] what happens when people do not check
return values [1].

> But it doesn't give you any good way to handle it. A SIGPIPE 
> can be due to any pipe being written, it doesn't tell you which 
> one. In order to know which one caused it, well, you have to 
> look at the error code of the call!

Fortunately the D runtime /does/ take care and it throws---if the 
signal
is ignored beforehand. I filed issue 21649.

[1] <https://lore.kernel.org/patchwork/patch/260181/>
     move RLIMIT_NPROC check from set_user() to do_execve_common()


More information about the Digitalmars-d-learn mailing list