setTimeout($timeout); $process->mustRun(); $output = $process->getOutput(); if (static::isValidOutput($output)) { return true; } } catch (InvalidArgumentException | LogicException | ProcessFailedException | RuntimeException $e) { $output = $e->getMessage(); } logger('Console output:: ' . $output); return $output; } public static function isValidOutput($output) { $errors = [ 'Content-Type: application/json', 'CSRF token mismatch', ]; return !Str::contains($output, $errors); } }