tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: why complain about a broken pipe?

> [...two "Broken pipe" reports from piping into head -1...]

> Why should any write to standard output should ever result in a an
> error message?  The user can perfectly well see what happened and
> always has the option of testing the return status.

The user can't always see what happened; there not even be any "the
user".  In a simple local pipeline run interactively by a sophisticated
user, perhaps.  None of those conditions is anything like universal.

> It is normal for readers of pipes to close them before EOF,

Is it?  That's not my perception.  I can think of only three cases in
which I've commonly had programs close pipes before reading EOF:
head(1), my tar (which is arguably a bug), and cases like dd being
specifically told to read only a certain amount.

> and the reader has no way to tell the writer why.  If an error
> condition exists, it's the reader's job to say so.

The reader may not have any way to report to whoever ran the writer;
SIGPIPE exists over the network too.  Would you rather lose the
messages in that case too, or have printing them be conditional on
whether the output in question is going to a pipe or a network socket
or something else, or what?

> Now pressing ^S ....

Heh.  On this list?!

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML      
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Home | Main Index | Thread Index | Old Index