diff --git a/vendor/phangoapp/leviathanutils/src/Linux.php b/vendor/phangoapp/leviathanutils/src/Linux.php index 0a22f2a..17e3f35 100644 --- a/vendor/phangoapp/leviathanutils/src/Linux.php +++ b/vendor/phangoapp/leviathanutils/src/Linux.php @@ -7,34 +7,6 @@ class Linux { static public function shell_command($arr_command, $exit_if_error=0) { - $error=0; - - /*$process=new Process($arr_command); - - $process->run(function ($type, $buffer): bool { - - if (Process::ERR === $type) { - - echo $buffer; - - $error=1; - - } else { - - echo $buffer; - - } - - }); - - if($error && $exit_if_error) { - - exit(1); - - } - echo 'Error'.$error; - return $error;*/ - $cmd=implode(' ', $arr_command); $a = popen($cmd, 'r'); @@ -47,11 +19,13 @@ class Linux { } - if(pclose($a)>0) { + $result=pclose($a); + + if($result>0) { echo 'Error executing command '.$cmd."\n"; - exit(1); + exit($result); }