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

Simpler exit code piping

This commit is contained in:
Aaron Piotrowski 2017-02-03 16:10:22 -06:00
parent f2a8b44c40
commit 53b45ce0b9

View File

@ -132,9 +132,7 @@ class Process {
["pipe", "w"], // exit code pipe
];
$nd = \strncasecmp(\PHP_OS, "WIN", 3) === 0 ? "NUL" : "/dev/null";
$command = \sprintf('(%s) 3>%s; code=$?; echo $code >&3; exit $code', $this->command, $nd);
$command = $this->command . "; echo $? >&3";
$this->process = @\proc_open($command, $fd, $pipes, $this->cwd ?: null, $this->env ?: null, $this->options);