bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] system() should return != 0 when the process is killed


From: Stephane Chazelas
Subject: Re: [bug-gawk] system() should return != 0 when the process is killed
Date: Fri, 11 Mar 2016 14:38:25 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

2016-03-05 08:47:36 +0000, Stephane Chazelas:
[...]
> ^1 Upon close() of a pipeline, as in:
> 
> awk 'BEGIN {cmd = "kill -s INT $$"; cmd | getline; print close(cmd)}'
[...]
> But when it comes to the exit status (where s is the value returned by
> pclose(3)/waitpid(2) like for system() above), we see:
[...]
>   * gawk: returns s&255 if killed (includes the core bit), s>>8
>     otherwise.
>   * bwk-awk: gives s (exit 1 gives 256, killed by SIGINT gives 2, killed
>     by SIGSEGV with core gives 139).
>   * mawk: same as for system(), looks like mawk is the only
>     implementation that gave any thought into that.
[...]

Sorry, looks like I had messed up my tests. gawk does indeed
behave like bwk-awk here. That is, close() returns the value
returned by pclose(3).

-- 
Stephane



reply via email to

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