io: Silence write error with EPIPE

With something like

```
history | head -n 1
```

this would error "write: Broken pipe", which is just annoying. There
is no *problem* here, `head` closes this on purpose.

Fixes #7924.
This commit is contained in:
Fabian Homborg 2021-04-13 10:38:17 +02:00
parent a918cabf5e
commit 3e473b9f37

View file

@ -306,7 +306,9 @@ void fd_output_stream_t::append(const wchar_t *s, size_t amt) {
int res = wwrite_to_fd(s, amt, this->fd_);
if (res < 0) {
// TODO: this error is too aggressive, e.g. if we got SIGINT we should not complain.
wperror(L"write");
if (errno != EPIPE) {
wperror(L"write");
}
errored_ = true;
}
}