async icon indicating copy to clipboard operation
async copied to clipboard

Fail if `unserialize` is unable to parse output of child process

Open MarcHagen opened this issue 5 months ago • 0 comments

In ParallelProcess in getOutput() is checked if the unserialize is successful. When it fails, is sets the errorOutput to the process output.
https://github.com/spatie/async/blob/c270e692f6eabafb4312e1ecd44e062032785635/src/Process/ParallelProcess.php#L71-L75

But this is not validated anymore because the check is already passed. https://github.com/spatie/async/blob/c270e692f6eabafb4312e1ecd44e062032785635/src/Process/ProcessCallbacks.php#L35-L50

Moving the getOutput() before the error output check will ensure all error output cases are handled properly.

Adding extra checks on the output of the child processes, we can ensure the output of the task is not false or null, falsely triggering the errorOutput. By changing the ChildRuntime output to a predictable array ensures we can check if something is wrong with parsing the child processes output.

MarcHagen avatar Aug 28 '24 21:08 MarcHagen