|
@@ -97,14 +97,24 @@ class TaskLoggerService implements ConsumerInterface
|
|
|
$predir = getcwd();
|
|
|
chdir(dirname($filename));
|
|
|
$process = new Process($filename);
|
|
|
- $process->run();
|
|
|
- chdir($predir);
|
|
|
-
|
|
|
-
|
|
|
+ try {
|
|
|
+ $process->run();
|
|
|
+ chdir($predir);
|
|
|
+ $output = $process->getOutput();
|
|
|
+ $error = $process->getErrorOutput();
|
|
|
+ $exit_code = $process->getExitCode();
|
|
|
+ } catch (\Throwable $t) {
|
|
|
+ $output = $filename .
|
|
|
+ "\n==================================ERROR==================================\n";
|
|
|
+ $error = "\n==================================ERROR==================================\n" .
|
|
|
+ $t->getMessage() . "\n" . $t->getTraceAsString() .
|
|
|
+ "\n==================================ERROR==================================\n";
|
|
|
+ $exit_code = $t->getCode();
|
|
|
+ }
|
|
|
return array(
|
|
|
- 'output' => $process->getOutput(),
|
|
|
- 'error' => $process->getErrorOutput(),
|
|
|
- 'exit_code' => $process->getExitCode(),
|
|
|
+ 'output' => $output,
|
|
|
+ 'error' => $error,
|
|
|
+ 'exit_code' => $exit_code,
|
|
|
);
|
|
|
}
|
|
|
|