Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metadata with more bare results to Result #68

Open
gisostallenberg opened this issue Jul 22, 2022 · 3 comments
Open

Add metadata with more bare results to Result #68

gisostallenberg opened this issue Jul 22, 2022 · 3 comments

Comments

@gisostallenberg
Copy link
Contributor

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.

@kbond
Copy link
Member

kbond commented Jul 22, 2022

I agree, would you be willing to create a PR?

@gisostallenberg
Copy link
Contributor Author

Would you rather see an additional argument or an event?

@kbond
Copy link
Member

kbond commented Jul 27, 2022

Another argument seems simplest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants