Why does cURL return error “(23) Failed writing body”?

It works ok as a single tool:

curl "someURL"
curl -o - "someURL"

but it doesn’t work in a pipeline:

curl "someURL" | tr -d '\n'
curl -o - "someURL" | tr -d '\n'

it returns:

(23) Failed writing body

What is the problem with piping the cURL output? How to buffer the whole cURL output and then handle it?

Leave a Comment