-
Notifications
You must be signed in to change notification settings - Fork 1k
Add WP_CLI_ALIAS_GROUPS_PARALLEL environment variable for concurrent alias group execution #6129
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: swissspidy <[email protected]>
Co-authored-by: swissspidy <[email protected]>
Co-authored-by: swissspidy <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: swissspidy <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: swissspidy <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
- Escape $script_path and $alias to prevent shell injection - Precompute command components once to avoid duplication - Add comment about non-deterministic output in parallel mode Co-authored-by: swissspidy <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
5946f90 to
649cdfe
Compare
|
/gemini review |
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.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add support for parallel processing of alias groups in WP-CLI.
Currently, when running a command against an alias group (e.g.,
@allor a custom group like@both), WP-CLI processes each alias sequentially. This change adds support for parallel execution via theWP_CLI_ALIAS_GROUPS_PARALLELenvironment variable, significantly improving execution speed when running commands across multiple WordPress installations.Changes Made
WP_CLI_ALIAS_GROUPS_PARALLELenvironment variable supportrun_alias_group()method in Runner.php to check the environment variableImplementation Details
The implementation uses the
WP_CLI_ALIAS_GROUPS_PARALLELenvironment variable:1), spawns all alias processes concurrently before waiting for resultsNote: In parallel mode, output from multiple processes will be interleaved and non-deterministic. This is expected behavior when running commands concurrently.
Usage Examples
Performance Benefits
This change provides significant performance improvements when:
Backward Compatibility
The default behavior remains unchanged - aliases are processed sequentially unless the
WP_CLI_ALIAS_GROUPS_PARALLELenvironment variable is set. This ensures no breaking changes for existing workflows.Security Summary
✅ All shell arguments are properly escaped using
escapeshellarg()✅ No new security vulnerabilities introduced
✅ Code review completed with no issues
✅ CodeQL security scan completed with no findings
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.