Conditions | 3 |
Paths | 4 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function run() |
||
17 | { |
||
18 | if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
||
19 | $pythonPath = exec("where python"); |
||
20 | } else { |
||
21 | $pythonPath = exec("which python"); |
||
22 | } |
||
23 | $command = $pythonPath . " " . $this->file_path . " 2>&1"; |
||
24 | $pid = popen($command, "r"); |
||
25 | while (!feof($pid)) { |
||
26 | $this->out_put .= fread($pid, 256); |
||
27 | flush(); |
||
28 | ob_flush(); |
||
29 | usleep(100000); |
||
30 | } |
||
31 | pclose($pid); |
||
32 | return $this->out_put; |
||
33 | } |
||
34 | } |
||
35 |