schedule-bundle
schedule-bundle copied to clipboard
Add metadata with more bare results to Result
After tasks are run a Result
is created, but some result data is formatted or discarded.
For example if a Process
fails:
return Result::failure(
$task,
"Exit {$process->getExitCode()}: {$process->getExitCodeText()}",
$process->getOutput().$process->getErrorOutput()
);
in ProcessTaskRunner
makes it impossible to get the Process
and for example get the exit code (without extracting it from the description).
I suggest to add an array with metadata as last argument of Result::__construct
and all related static methods which can accept various data regarding the run of the task. The Process
for a process task run, the plain output for a callback task run, the plain output and exit code for a command task run, ...
An alternative would be to add an AfterTaskRun event with the above details of the task that ran and dispatch this in each task runners invoke method.
I agree, would you be willing to create a PR?
Would you rather see an additional argument or an event?
Another argument seems simplest.