Opened 3 years ago

Closed 2 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 Difficulty: Unknown
Test Case: T4889 Blocked By:
Blocking: Related Tickets:

Description

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:

http://www.haskell.org/pipermail/libraries/2010-December/015366.html

Attached patch ignores output exceptions.

Attachments (1)

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

Download all attachments as: .zip

Change History (8)

comment:1 Changed 3 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 3 years ago by igloo

  • Milestone set to 7.2.1
  • Status changed from new to patch

comment:3 Changed 3 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 3 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 2 years ago by igloo

  • Milestone changed from 7.4.1 to 7.6.1

comment:6 Changed 2 years ago by simonpj

  • Difficulty set to Unknown
  • Owner set to pcapriotti

comment:7 Changed 2 years ago by pcapriotti

  • Resolution set to fixed
  • Status changed from patch to closed
  • Test Case set to T4889
commit 76fb4b7e8861dec8054723a3c794c73511d07bb2
Author: Paolo Capriotti <p.capriotti@gmail.com>
Date:   Thu May 10 13:41:37 2012 +0100

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