[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gawk] system() should return != 0 when the process is killed
From: |
Tobia Conforto |
Subject: |
[bug-gawk] system() should return != 0 when the process is killed |
Date: |
Thu, 3 Mar 2016 17:58:25 +0100 |
Hello
It looks like gawk's system() only returns bits 8 to 15 (or s>>8) of the value returned by system(3), discarding any information about the termination of the child process by a signal.
This breaks use cases like this (and probably others):
do {
...
} while (! system("sleep 10"))
where the intention is to break the loop when the user interrupts (^C) the child process.
It would arguably be better if gawk returned a composite code, as traditionally done by most shells and interpreters, for example (s&127)+128 if killed, s>>8 otherwise, as in Bash.
Other awk implementations (nawk, bwk-awk, and mawk) always return values != 0 when the child process executed by system() is killed by a signal.
-Tobia
- [bug-gawk] system() should return != 0 when the process is killed,
Tobia Conforto <=
Re: [bug-gawk] system() should return != 0 when the process is killed, Stephane Chazelas, 2016/03/05
Re: [bug-gawk] system() should return != 0 when the process is killed, Aharon Robbins, 2016/03/07