8000 Merge branch '2.8' into 3.0 · symfony/symfony@f72f2f0 · GitHub
[go: up one dir, main page]

Skip to content

Commit f72f2f0

Browse files
Merge branch '2.8' into 3.0
* 2.8: [Process] Fix the fix for --enable-sigchild php
2 parents 6c5f736 + b7d18f9 commit f72f2f0

File tree

2 files changed

+6
-29
lines changed

2 files changed

+6
-29
lines changed

src/Symfony/Component/Process/Process.php

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,6 @@ class Process
7575
private $latestSignal;
7676

7777
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-
);
8678

8779
/**
8880
* Exit codes translation table.
@@ -289,14 +281,9 @@ public function start(callable $callback = null)
289281
// last exit code is output on the fourth pipe and caught to work around --enable-sigchild
290282
$descriptors[3] = array('pipe', 'w');
291283

292-
$commandline = '';
293-
foreach (self::$posixSignals as $s) {
294-
$commandline .= "trap 'echo s$s >&3' $s;";
295-
}
296-
297284
// 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';
300287

301288
// Workaround for the bug, when PTS functionality is enabled.
302289
// @see : https://bugs.php.net/69442
@@ -1314,19 +1301,9 @@ private function readPipes($blocking, $close)
13141301
$callback = $this->callback;
13151302
foreach ($result as $type => $data) {
13161303
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;
13301307
}
13311308
} else {
13321309
$callback($type === self::STDOUT ? self::OUT : self::ERR, $data);

src/Symfony/Component/Process/Tests/ProcessTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ public function testRunProcessWithTimeout()
773773

774774
if ('\\' !== DIRECTORY_SEPARATOR) {
775775
// On Windows, timers are too transient
776-
$maxDuration = $timeout + Process::TIMEOUT_PRECISION;
776+
$maxDuration = $timeout + 2 * Process::TIMEOUT_PRECISION;
777777
$this->assertLessThan($maxDuration, $duration);
778778
}
779779

0 commit comments

Comments
 (0)
0