Skip to content

Commit

Permalink
- Added windows support.
Browse files Browse the repository at this point in the history
  • Loading branch information
rakshitbharat committed Feb 25, 2020
1 parent 4a6620d commit 90db1f3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/PythonRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ public function pythonGrabber($pythonFilePathLaravelFormat)

public function run()
{
$command = "python " . $this->file_path . " 2>&1";
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$pythonPath = exec("where python");
} else {
$pythonPath = exec("which python");
}
$command = $pythonPath . " " . $this->file_path . " 2>&1";
$pid = popen($command, "r");
while (!feof($pid)) {
$this->out_put .= fread($pid, 256);
Expand Down

0 comments on commit 90db1f3

Please sign in to comment.