Opened 7 years ago

Closed 5 years ago

#4889 closed feature request (fixed)

Ignore broken pipe error when writing to a died process

Reported by: guest Owned by: pcapriotti
Priority: normal Milestone: 7.6.1
Component: libraries/process Version:
Keywords: Cc:
Operating System: Linux Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: T4889
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


In readProcessWithExitCode, when child dies without reading whole input we get a pipe error. This happens when child program is not satisfied with input or does not need whole input. In such a case error code from the child program is more expected.

The solution is to ignore write error (broken pipe).

For a (short) discussion of issue see thread:

Attached patch ignores output exceptions.

Attachments (1)

ignore-broken-pipe-error-when-writing-to-a-died-process.dpatch (4.4 KB) - added by guest 7 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 7 years ago by simonmar

Thanks. A couple of comments on the patch:

  • could we ignore the correct exception, not just all IO exceptions?
  • please add a comment describing the problem and the ticket number

comment:2 Changed 7 years ago by igloo

Milestone: 7.2.1
Status: newpatch

comment:3 Changed 7 years ago by guest

Hmm, seems the error we want to ignore is ResourceVanished. At least this is what I see in the discussion of bug #2699.

How do I catch ResourceVanished IOError only? This constructor seems to not be exported from anywhere...

comment:4 Changed 7 years ago by simonmar

Look at the code in GHC/TopHandler.lhs in the base package, around line 166. You need to import the internals of IOError, I think from GHC.IO.Exception.

comment:5 Changed 6 years ago by igloo


comment:6 Changed 5 years ago by simonpj

difficulty: Unknown
Owner: set to pcapriotti

comment:7 Changed 5 years ago by pcapriotti

Resolution: fixed
Status: patchclosed
Test Case: T4889
commit 76fb4b7e8861dec8054723a3c794c73511d07bb2
Author: Paolo Capriotti <>
Date:   Thu May 10 13:41:37 2012 +0100

    Ignore broken pipe error in readProcessWithExitCode (#4889)
Note: See TracTickets for help on using tickets.