Skip to content

Commit be8b7f9

Browse files
author
Jason Greene
committed
Signal numbers are not uniform accross all platforms.
Modified test to use the constants unless a failure occurs.
1 parent 805c76f commit be8b7f9

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

ext/pcntl/tests/001.phpt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ function test_exit_signal(){
3232
$options=0;
3333
posix_kill($pid, SIGTERM);
3434
pcntl_waitpid($pid, &$status, $options);
35-
if ( pcntl_wifsignaled($status) ) print "\nProcess was terminated by signal : ". pcntl_wtermsig($status);
35+
if ( pcntl_wifsignaled($status) ) {
36+
$signal_print=pcntl_wtermsig($status);
37+
if ($signal_print==SIGTERM) $signal_print="SIGTERM";
38+
print "\nProcess was terminated by signal : ". $signal_print;
39+
}
40+
3641
}
3742
}
3843

@@ -49,7 +54,11 @@ function test_stop_signal(){
4954
$options=WUNTRACED;
5055
posix_kill($pid, SIGSTOP);
5156
pcntl_waitpid($pid, &$status, $options);
52-
if ( pcntl_wifstopped($status) ) print "\nProcess was stoped by signal : ". pcntl_wstopsig($status);
57+
if ( pcntl_wifstopped($status) ) {
58+
$signal_print=pcntl_wstopsig($status);
59+
if ($signal_print==SIGSTOP) $signal_print="SIGSTOP";
60+
print "\nProcess was stoped by signal : ". $signal_print;
61+
}
5362
posix_kill($pid, SIGCONT);
5463
}
5564
}
@@ -66,7 +75,7 @@ Testing pcntl_wifexited and wexitstatus....-1
6675
Exited With: -1
6776

6877
Testing pcntl_wifsignaled....
69-
Process was terminated by signal : 15
78+
Process was terminated by signal : SIGTERM
7079

7180
Testing pcntl_wifstopped and pcntl_wstopsig....
72-
Process was stoped by signal : 19
81+
Process was stoped by signal : SIGSTOP

0 commit comments

Comments
 (0)