bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH]


From: Eli Zaretskii
Subject: Re: [bug-gawk] Behavior of fflush with SIGPIPE on stdout [PATCH]
Date: Sat, 08 Apr 2017 20:51:05 +0300

> Date: Sat, 8 Apr 2017 19:19:43 +0200
> From: <address@hidden>
> CC: <address@hidden>, <address@hidden>
> 
> You wrote:
> 
>   +/* 0xC0000008 is EXCEPTION_INVALID_HANDLE, somewhat appropriate for EPIPE 
> */
> 
> but "invalid handle" does not give a meaningful clue to the startled 
> developer.

It's an exception value that is the closest in meaning to what happens
here.

The model I used is that of a program that crashes due to the Windows
equivalent of SIGSEGV.  Such a program exits with a status of
0xC0000005, which is the value of EXCEPTION_ACCESS_VIOLATION.  So I
looked for an exception that would be related to broken pipe, and this
is the closest one I found.

> A better value would somehow point to what has actually happened, like 
> ERROR_BROKEN_PIPE:

No, ERROR_BROKEN_PIPE is an error code, not an exception code.

> Of course that's a small number (error) not in the 0xC... range like your 
> exception; by analogy with unix I'd just add 
> an unused, large constant like 0xE0000000

I don't see how exiting with arbitrary status values could serve any
useful purpose in this case.  Some ported programs (like Guile, for
example) need to see the 0xC000000n codes of the programs they invoke
to produce reasonable diagnostics, and the exit status I've chosen
plays well with those programs.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]