-
Notifications
You must be signed in to change notification settings - Fork 1k
Auto-rerun command after Phar update #6194
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
…confirm Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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
This PR enhances WP-CLI's auto-update feature by automatically re-executing the original command after a successful Phar update, eliminating the need for users to manually re-run their commands. It also adds an optional environment variable to skip the update confirmation prompt.
Changes:
- Implemented automatic command re-execution after Phar updates via a new
rerun_command_after_update()method - Added
WP_CLI_AUTO_UPDATE_PROMPTenvironment variable to optionally skip the confirmation prompt - Updated the auto-update flow to call the new re-execution method instead of immediately exiting
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Implementation Complete: Auto-rerun command after Phar update
Summary
This PR resolves the issue where users had to manually re-run their WP-CLI command after an auto-update was installed. The implementation automatically re-executes the original command with the updated Phar, providing a seamless update experience.
Changes Implemented
✅ Environment Variable for Auto-Confirmation (
WP_CLI_AUTO_UPDATE_PROMPT)'no'to skip the update confirmation prompt--yesto thecli updatecommand✅ Automatic Command Re-execution
passthru()for subprocess executionescapeshellarg()✅ Safety Mechanisms
realpath()result and shows error if it fails$_SERVER['argv']throughoutTesting
Benefits
Technical Details
$GLOBALS['argv']to retrieve original arguments$_SERVER['argv'][0]for Phar path (consistent with existing code)Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.