louie mcconnell
louie mcconnell

Reputation: 761

What is a broken pipe error?

Running code in python, I discovered a "Broken Pipe Error." Can someone please explain to me what this is simply?

Thanks.

Upvotes: 15

Views: 25283

Answers (1)

salezica
salezica

Reputation: 76929

A pipe connects two processes. One of these processes holds the read-end of the pipe, and the other holds the write-end.

When the pipe is written to, data is stored in a buffer waiting for the other processes to retrieve it.

What happens if a process is writing to a pipe, but the process on the other side suddenly exits or closes the pipe? Or the other way round, a process is reading just as the writer finishes or closes?

This input/output error is called a broken pipe.

Upvotes: 30

Related Questions