From 53b45ce0b90715940c19fccebde957d4cc46503c Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Fri, 3 Feb 2017 16:10:22 -0600 Subject: [PATCH] Simpler exit code piping --- lib/Process.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/Process.php b/lib/Process.php index 516c9ed..fc42ee5 100644 --- a/lib/Process.php +++ b/lib/Process.php @@ -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);