I'm trying to catch the output of the command and throw error/success accordingly.
$resultFromServer = [];
SSH::run($command, function($line)
{
echo $line.PHP_EOL;
if($line!= null) {
array_push($resultFromServer, $line); // crash
}
});
dd($resultFromServer);
Check out my output
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config Error: open test.yaml: no such file or directory
[]
I'm trying to look for this string Error:
and whatever to the right of it, I will display in my alert message.
Error: open test.yaml: no such file or directory
I'm trying
to store each line into an array and loop through and check for string contain, but I can't even store it into the array.
I kept getting a crash - if - I uncomment that line
How do I prevent the crash ? Do I need to add some sleep() ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire