@@ -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($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
@@ -1353,19 +1340,9 @@ private function readPipes($blocking, $close)
1353
1340
$ callback = $ this ->callback ;
1354
1341
foreach ($ result as $ type => $ data ) {
1355
1342
if (3 === $ type ) {
1356
- foreach (explode ("\n" , substr ($ data , 0 , -1 )) as $ data ) {
1357
- if ('p ' === $ data [0 ]) {
1358
- $ this ->fallbackStatus ['pid ' ] = (int ) substr ($ data , 1 );
1359
- } elseif ('s ' === $ data [0 ]) {
1360
- $ this ->fallbackStatus ['signaled ' ] = true ;
1361
- $ this ->fallbackStatus ['exitcode ' ] = -1 ;
1362
- $ this ->fallbackStatus ['termsig ' ] = (int ) substr ($ data , 1 );
1363
- } elseif ('x ' === $ data [0 ]) {
1364
- $ this ->fallbackStatus ['running ' ] = false ;
1365
- if (!isset ($ this ->fallbackStatus ['signaled ' ])) {
1366
- $ this ->fallbackStatus ['exitcode ' ] = (int ) substr ($ data , 1 );
1367
- }
1368
- }
1343
+ $ this ->fallbackStatus ['running ' ] = false ;
1344
+ if (!isset ($ this ->fallbackStatus ['signaled ' ])) {
1345
+ $ this ->fallbackStatus ['exitcode ' ] = (int ) $ data ;
1369
1346
}
1370
1347
} else {
1371
1348
$ callback ($ type === self ::STDOUT ? self ::OUT : self ::ERR , $ data );
0 commit comments