[darcs-users] [trivial] darcs dies when hitting EPIPE on stdout

Aggelos Economopoulos aoiko at cc.ece.ntua.gr
Sun Feb 1 14:17:27 UTC 2004


On Sat, 31 Jan 2004 09:50:19 -0500
David Roundy <droundy at abridgegame.org> wrote:

> On Wed, Dec 31, 2003 at 12:37:52AM +0200, Aggelos Economopoulos wrote:
> > Trivial testcase:
> > 
> > aggelos at erwin:~/src/darcs/darcs> darcs changes | head  > /dev/null
> > 
> > Fail: resource vanished
> > Action: commitAndReleaseBuffer
> > Handle: {loc=<stdout>,type=writable,binary=False,buffering=block
> > (1024)} Reason: Broken pipe
> > File: <stdout>
> > 
> > aggelos at erwin:~/src/darcs/darcs>
> > 
> > Would it be easy to special-case EPIPE?
> 
> Fixed.  It isn't particularly clean, but I've got it working at least
> under ghc 6.2.  The problem was that I fixed darcs so it would clean
> up after itself in case of a sigPIPE signal (rather than leaving
> temporaries lying around), but since I throw an asynchronous exception
> in case of sigPIPE, the synchronous exception due to writing to stdout
> happens first, and I don't know the type of that exception.  What I've
> done is to exit without an error message when there is an IO exception
> on the file "<stdout>". This is obviously rather ugly, but I can't see
> how to find out if the error is EPIPE.

Can you at least write a C function to test if stdout is a pipe and
only then skip the error message?

In any case, if a "proper" fix is too ugly / too much work I don't think
this is a useful change; I'd rather not miss important error messages
(e.g. ENOSPC, EIO etc.) because of aesthetic reasons. OTOH, since this
will look bad to new darcs users you might want to keep this patch. Have
fun deciding :)

Thanks,
Aggelos





More information about the darcs-users mailing list