Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
makhov committed Aug 31, 2015
1 parent 01951b8 commit 7cd096e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/Tomita/TomitaException.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?php
/**
* Exception class for Tomita Parser
* User: makhov
* Date: 10.08.15
* Time: 10:03
*
* @author Alexey Makhov <[email protected]>
*/

namespace Tomita;
Expand Down
17 changes: 9 additions & 8 deletions src/Tomita/TomitaParser.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* User: makhov
* Date: 10.08.15
* Time: 0:11
* Simple facade to use Yandex Tomita.Parser
*
* @author Alexey Makhov <[email protected]>
*/

namespace Tomita;
Expand All @@ -20,21 +20,22 @@ 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)) {

fwrite($pipes[0], $text);
fclose($pipes[0]);

$output = stream_get_contents($pipes[1]);

fclose($pipes[1]);
fclose($pipes[2]);

Expand Down

0 comments on commit 7cd096e

Please sign in to comment.