LaravelCollective/remote

Catching Output From Commands not work properly

Closed this issue · 1 comments

 $cmd[] = 'whmapi1 listaccts --output=json';
            $exit  = '';
            SSH::into('dev')->run($cmd, function ($line) use (&$exit)
            {
                $exit = $line;
            });
            file_put_contents(base_path().'/json.txt',$exit);

Instead of saving the entire string returned by the command, I find that only returns the last part of the string.

trim(preg_replace('/\s\s+/', ' ', $exit))

Oops. I think after read doc, that exit command it's a $string. Now, i see it can an $array.