Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #70 from ArtisanTinkerer/master
Browse files Browse the repository at this point in the history
Added .' 2>&1' to the exec command.
  • Loading branch information
cossou authored Jun 29, 2017
2 parents c238012 + 814a949 commit 2ed2c0c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/JasperPHP/JasperPHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function output()
public function execute($run_as_user = false)
{
if( $this->redirect_output && !$this->windows)
$this->the_command .= " > /dev/null 2>&1";
$this->the_command .= " 2>&1";

if( $this->background && !$this->windows )
$this->the_command .= " &";
Expand All @@ -174,9 +174,12 @@ public function execute($run_as_user = false)

exec($this->the_command, $output, $return_var);

if($return_var != 0)
if( $return_var != 0 && isset($output[0]) )
throw new \Exception($output[0], 1);

elseif( $return_var != 0 )
throw new \Exception("Your report has an error and couldn't be processed! Try to output the command using the function `output();` and run it manually in the console.", 1);

return $output;
}
}

0 comments on commit 2ed2c0c

Please sign in to comment.