diff --git a/src/Tomita/TomitaException.php b/src/Tomita/TomitaException.php index f3b8a03..3c4ddc8 100644 --- a/src/Tomita/TomitaException.php +++ b/src/Tomita/TomitaException.php @@ -1,9 +1,8 @@ */ namespace Tomita; diff --git a/src/Tomita/TomitaParser.php b/src/Tomita/TomitaParser.php index 3bc87f5..6c1325d 100644 --- a/src/Tomita/TomitaParser.php +++ b/src/Tomita/TomitaParser.php @@ -1,8 +1,8 @@ */ namespace Tomita; @@ -20,14 +20,14 @@ public function __construct($execPath, $configPath) { } public function run($text) { - $descriptorspec = array( - 0 => array('pipe', 'r'), - 1 => array('pipe', 'w'), - 2 => array('pipe', 'w') + $descriptors = array( + 0 => array('pipe', 'r'), // stdin + 1 => array('pipe', 'w'), // stdout + 2 => array('pipe', 'w') // stderr ); $cmd = sprintf('%s %s', $this->execPath, $this->configPath); - $process = proc_open($cmd, $descriptorspec, $pipes, dirname($this->configPath)); + $process = proc_open($cmd, $descriptors, $pipes, dirname($this->configPath)); if (is_resource($process)) { @@ -35,6 +35,7 @@ public function run($text) { fclose($pipes[0]); $output = stream_get_contents($pipes[1]); + fclose($pipes[1]); fclose($pipes[2]);