-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Process] allow setting options esp. "create_new_console" to detach a subprocess #37519
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some tests please, eg for the validation of options?
Please also update the CHANGELOG of the component btw. |
54751db
to
02551ed
Compare
02551ed
to
e9ab235
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without create_new_console you can't terminate your main script and let the process run
That's a very good point, it made me change my mind.
I updated the PR to keep only the actually supported option and made create_new_console
"detach" the subprocess by closing pipes on both Windows and *nix
.
This means we don't need the detach
pseudo-option anymore.
PR is good for me as is now, thanks for the discussion.
Thank you @andrei0x309. |
Process.php to include support for create_new_console (Windows ONLY)
Based on this issue: #36583
I created a quick repo https://github.com/andrei0x309/tets_sym_proc to illustrate
how this feature can be used, it essentially lets you run something even if your main script has terminated.
It is useful if you want to create something like
new Process(['php', 'script_with_long_execution_time.php']);
This was impossible to do on windows until the create_new_console flag was added in PHP 7.4.4.
With this feature Process can be used like this: