Fix in exec command
This commit is contained in:
parent
585e1a99b0
commit
b54fa9c553
1 changed files with 4 additions and 30 deletions
34
vendor/phangoapp/leviathanutils/src/Linux.php
vendored
34
vendor/phangoapp/leviathanutils/src/Linux.php
vendored
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue