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

support $cmd as array in Process #107

Open
staabm opened this issue Mar 24, 2024 · 3 comments
Open

support $cmd as array in Process #107

staabm opened this issue Mar 24, 2024 · 3 comments

Comments

@staabm
Copy link
Contributor

staabm commented Mar 24, 2024

I recently started optimizing phpunit process isolation. while doing research I found out, that proc_open can start processes with a lot less overhead when using a array argument.

would be great if we could use Process with a array argument, so we can start processes with less overhead in e.g. PHPStan

@staabm staabm added the bug label Mar 24, 2024
@WyriHaximus
Copy link
Member

Just a random thought, but if it's faster, why not internally change it to an array and always have that performance gain?

@staabm
Copy link
Contributor Author

staabm commented Mar 24, 2024

passing the arg as array has a few more implications. escaping of the command is done at php-src level and no longer in userland.

since the command is no longer run in a shell with array-notation it might depend also on the command whether we can apply array-style arg.
e.g. stderr->stdout redirection needs to be done differently via pipespec

it might make sense to look into the symfony process component for inspiration

@SimonFrings
Copy link
Member

Hey @staabm, thanks for the input on this, seems like a reasonable change 👍

If this works as well as you described it above, than I agree that this is a great addition to the project. Will have a look at this when time allows it, but until then we're more than happy about contributions for this. If someone has interest in opening a PR, it's important for us is that the pull request should not only focus on the implementation side of things, but also make sure that any new additions are also covered by our test suite (unit tests) to confirm the suggested changes work as expected.

Additionally, I don't think this is a bug ticket as nothing is currently broken; I think this is more of a feature suggestion. We recommend opening bug tickets only when you can provide evidence of something being broken, just as a friendly reminder for future tickets :)

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

No branches or pull requests

3 participants