From 1cf7dd62b920be4be459dd1fdbde904054a95b94 Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Mon, 28 Sep 2015 21:03:55 -0500 Subject: [PATCH] Better Windows support --- bin/process.php | 4 ++-- src/Process/Process.php | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/process.php b/bin/process.php index f19b399..597ed50 100644 --- a/bin/process.php +++ b/bin/process.php @@ -8,8 +8,8 @@ }, 1, 0); $paths = [ - dirname(dirname(dirname(__DIR__))) . '/autoload.php', - dirname(__DIR__) . '/vendor/autoload.php', + dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'autoload.php', + dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php', ]; $autoloadPath = null; diff --git a/src/Process/Process.php b/src/Process/Process.php index 66053d4..ec7966c 100644 --- a/src/Process/Process.php +++ b/src/Process/Process.php @@ -148,7 +148,9 @@ public function start() ['pipe', 'w'], // exit code pipe ]; - $command = sprintf('(%s) 3>/dev/null; code=$?; echo $code >&3; exit $code', $this->command); + $nd = 0 === strncasecmp(PHP_OS, 'WIN', 3) ? '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);