@@ -65,14 +65,6 @@ class Process
65
65
private $ latestSignal ;
66
66
67
67
private static $ sigchild ;
68
- private static $ posixSignals = array (
69
- 1 , // SIGHUP
70
- 2 , // SIGINT
71
- 3 , // SIGQUIT
72
- 6 , // SIGABRT
73
- 14 , // SIGALRM
74
- 15 , // SIGTERM
75
- );
76
68
77
69
/**
78
70
* Exit codes translation table.
@@ -246,14 +238,9 @@ public function start($callback = null)
246
238
// last exit code is output on the fourth pipe and caught to work around --enable-sigchild
247
239
$ descriptors [3 ] = array ('pipe ' , 'w ' );
248
240
249
- $ commandline = '' ;
250
- foreach (self ::$ posixSignals as $ s ) {
251
- $ commandline .= "trap 'echo s $ s >&3' $ s; " ;
252
- }
253
-
254
241
// See https://unix.stackexchange.com/questions/71205/background-process-pipe-input
255
- $ commandline . = '{ ( ' .$ this ->commandline .') <&3 3<&- 3>/dev/null & } 3<&0; ' ;
256
- $ commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo x $code >&3; exit $code ' ;
242
+ $ commandline = '{ ( ' .$ this ->commandline .') <&3 3<&- 3>/dev/null & } 3<&0; ' ;
243
+ $ commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code ' ;
257
244
258
245
// Workaround for the bug, when PTS functionality is enabled.
259
246
// @see : https://bugs.php.net/69442
@@ -1086,19 +1073,9 @@ private function readPipes($blocking, $close)
1086
1073
$ callback = $ this ->callback ;
1087
1074
foreach ($ result as $ type => $ data ) {
1088
1075
if (3 === $ type ) {
1089
- foreach (explode ("\n" , substr ($ data , 0 , -1 )) as $ data ) {
1090
- if ('p ' === $ data [0 ]) {
1091
- $ this ->fallbackStatus ['pid ' ] = (int ) substr ($ data , 1 );
1092
- } elseif ('s ' === $ data [0 ]) {
1093
- $ this ->fallbackStatus ['signaled ' ] = true ;
1094
- $ this ->fallbackStatus ['exitcode ' ] = -1 ;
1095
- $ this ->fallbackStatus ['termsig ' ] = (int ) substr ($ data , 1 );
1096
- } elseif ('x ' === $ data [0 ]) {
1097
- $ this ->fallbackStatus ['running ' ] = false ;
1098
- if (!isset ($ this ->fallbackStatus ['signaled ' ])) {
1099
- $ this ->fallbackStatus ['exitcode ' ] = (int ) substr ($ data , 1 );
1100
- }
1101
- }
1076
+ $ this ->fallbackStatus ['running ' ] = false ;
1077
+ if (!isset ($ this ->fallbackStatus ['signaled ' ])) {
1078
+ $ this ->fallbackStatus ['exitcode ' ] = (int ) $ data ;
1102
1079
}
1103
1080
} else {
1104
1081
$ callback ($ type === self ::STDOUT ? self ::OUT : self ::ERR , $ data );
0 commit comments