From b54fa9c5538e94408c6b919b24cdc631c961bd5e Mon Sep 17 00:00:00 2001 From: absurdo Date: Sat, 25 Nov 2023 00:57:24 +0100 Subject: [PATCH] Fix in exec command --- vendor/phangoapp/leviathanutils/src/Linux.php | 34 +++---------------- 1 file changed, 4 insertions(+), 30 deletions(-) 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); }