@@ -75,14 +75,6 @@ class Process
75
75
private $ latestSignal ;
76
76
77
77
private static $ sigchild ;
78
- private static $ posixSignals = array (
79
- 1 , // SIGHUP
80
- 2 , // SIGINT
81
- 3 , // SIGQUIT
82
- 6 , // SIGABRT
83
- 14 , // SIGALRM
84
- 15 , // SIGTERM
85
- );
86
78
87
79
/**
88
80
* Exit codes translation table.
@@ -289,14 +281,9 @@ public function start(callable $callback = null)
289
281
// last exit code is output on the fourth pipe and caught to work around --enable-sigchild
290
282
$ descriptors [3 ] = array ('pipe ' , 'w ' );
291
283
292
- $ commandline = '' ;
293
- foreach (self ::$ posixSignals as $ s ) {
294
- $ commandline .= "trap 'echo s $ s >&3' $ s; " ;
295
- }
296
-
297
284
// See https://unix.stackexchange.com/questions/71205/background-process-pipe-input
298
- $ commandline . = '{ ( ' .$ this ->commandline .') <&3 3<&- 3>/dev/null & } 3<&0; ' ;
299
- $ commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo x $code >&3; exit $code ' ;
285
+ $ commandline = '{ ( ' .$ this ->commandline .') <&3 3<&- 3>/dev/null & } 3<&0; ' ;
286
+ $ commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code ' ;
300
287
301
288
// Workaround for the bug, when PTS functionality is enabled.
302
289
// @see : https://bugs.php.net/69442
@@ -1314,19 +1301,9 @@ private function readPipes($blocking, $close)
1314
1301
$ callback = $ this ->callback ;
1315
1302
foreach ($ result as $ type => $ data ) {
1316
1303
if (3 === $ type ) {
1317
- foreach (explode ("\n" , substr ($ data , 0 , -1 )) as $ data ) {
1318
- if ('p ' === $ data [0 ]) {
1319
- $ this ->fallbackStatus ['pid ' ] = (int ) substr ($ data , 1 );
1320
- } elseif ('s ' === $ data [0 ]) {
1321
- $ this ->fallbackStatus ['signaled ' ] = true ;
1322
- $ this ->fallbackStatus ['exitcode ' ] = -1 ;
1323
- $ this ->fallbackStatus ['termsig ' ] = (int ) substr ($ data , 1 );
1324
- } elseif ('x ' === $ data [0 ]) {
1325
- $ this ->fallbackStatus ['running ' ] = false ;
1326
- if (!isset ($ this ->fallbackStatus ['signaled ' ])) {
1327
- $ this ->fallbackStatus ['exitcode ' ] = (int ) substr ($ data , 1 );
1328
- }
1329
- }
1304
+ $ this ->fallbackStatus ['running ' ] = false ;
1305
+ if (!isset ($ this ->fallbackStatus ['signaled ' ])) {
1306
+ $ this ->fallbackStatus ['exitcode ' ] = (int ) $ data ;
1330
1307
}
1331
1308
} else {
1332
1309
$ callback ($ type === self ::STDOUT ? self ::OUT : self ::ERR , $ data );
0 commit comments