✨ feat: refactor Ddev command execution to use execDdev wrapper #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors how DDEV commands are executed in the
DdevUtilsclass to improve consistency, reliability, and security. The main change is the introduction of a centralizedexecDdevmethod that wraps commands in a bash shell, disables XDEBUG, and properly escapes single quotes. All direct usages ofexecSyncfor DDEV commands are replaced with this wrapper, and the corresponding tests are updated to verify the new behavior and edge cases.Refactoring command execution:
All direct
execSynccalls for DDEV commands inDdevUtilsmethods are replaced with the newexecDdevwrapper, ensuring consistent command execution and proper escaping. [1] [2] [3]The
execDdevmethod now wraps commands inbash -c 'XDEBUG_MODE=off ...'and escapes single quotes to prevent shell injection issues.Testing improvements:
Unit tests for
DdevUtilsare updated to verify that the new wrapper is used, including checks for proper command formatting and escaping. [1] [2] [3] [4]Error handling in tests is improved to simulate realistic error scenarios and verify that user-facing error messages are accurate and informative.