1
0
mirror of https://github.com/danog/process.git synced 2025-01-22 05:41:17 +01:00

Revert exit code piping change; remove exit code verification

This commit is contained in:
Aaron Piotrowski 2017-02-03 16:32:30 -06:00
parent 53b45ce0b9
commit 37cf53aa27

View File

@ -132,7 +132,9 @@ class Process {
["pipe", "w"], // exit code pipe
];
$command = $this->command . "; echo $? >&3";
$nd = \strncasecmp(\PHP_OS, "WIN", 3) === 0 ? "NUL" : "/dev/null";
$command = \sprintf('(%s) 3>%s; code=$?; echo $code >&3; exit $code', $this->command, $nd);
$this->process = @\proc_open($command, $fd, $pipes, $this->cwd ?: null, $this->env ?: null, $this->options);
@ -178,9 +180,6 @@ class Process {
throw new ProcessException("Process ended unexpectedly");
}
$code = \rtrim(@\fread($resource, 3)); // Single byte written as string
if (!\strlen($code) || !\is_numeric($code)) {
throw new ProcessException("Process ended without providing a status code");
}
} finally {
if (\is_resource($resource)) {
\fclose($resource);