Open Arcesilas opened 1 month ago
Me again,
I've just tested to change ParentRuntime::childProcessScript
to $GLOBALS['argv'][0]
:
https://github.com/spatie/async/blob/c270e692f6eabafb4312e1ecd44e062032785635/src/Runtime/ParentRuntime.php#L45
Here I use $GLOBALS
only for testing purposes.
My main script handles the CLI arguments:
if ($argc > 1) {
require dirname(__DIR__) . '/vendor/spatie/async/src/Runtime/ChildRuntime.php';
}
This is very basic because this script does not take any argument, but you have the idea.
And it works.
So I think it should be nice to be able to simply customize the script we want to call as ChildRuntime somewhere in our main script.
Hi, I've been struggling to have async work in a Phar before I realize the child process is executed as a command like
php /path/to/project/vendor/spatie/async/src/Runtime/ChildRuntime.php ...
which cannot work when it's encapsulated in a Phar.Since it's not possible to directly run a script located in a Phar from CLI, is there any plan on supporting Phar in a future?
It would require the
ParentRuntime
to call the main script with specific arguments and the Phar stub to handle these arguments to not run the main "parent script", butChildRuntime
.Not sure it's possible to use async in a Phar without modifying how
ParentRuntime
runs theChildRuntime
.