From af0074547dd9e2d6e1821c0b77c57f41aef55e8c Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sat, 21 Sep 2019 14:01:19 -0400 Subject: [PATCH] * tests/scripts/functions/shell: Detect correct SHELLSTATUS code. --- tests/scripts/functions/shell | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/scripts/functions/shell b/tests/scripts/functions/shell index 3ffa1d8d..54514e83 100644 --- a/tests/scripts/functions/shell +++ b/tests/scripts/functions/shell @@ -61,11 +61,21 @@ all: ; @echo $(.SHELLSTATUS) # Test SHELLSTATUS for kill. # This test could be ported to Windows, using taskkill ... ? + + # Figure out the exit code for SIGINT + my $pid = fork(); + if (! $pid) { + exec('kill -2 $$') or die "exec: Cannot execute sleep\n"; + } + waitpid($pid, 0); + # .SHELLSTATUS for a signal gives 128 + the signal number + my $ret = $? + 128; + run_make_test('.PHONY: all $(shell kill -2 $$$$) -SIG := $(.SHELLSTATUS) -all: ; @echo SIG=$(SIG) - ','','SIG=130'); +STAT := $(.SHELLSTATUS) +all: ; @echo STAT=$(STAT) + ','',"STAT=$ret\n"); } 1; -- 2.47.3