Skip to content

Conversation

@Morgy93
Copy link
Contributor

@Morgy93 Morgy93 commented Dec 27, 2025

This pull request improves how shell commands are executed within the DdevUtils utility class to ensure that the Xdebug extension is disabled during execution, which helps prevent issues with command hanging or slowness. It also adds tests to verify the new behavior, including proper escaping of single quotes in commands.

Command execution improvements:

  • Updated the execDdev method in DdevUtils to wrap commands with bash -c 'XDEBUG_MODE=off ...' so that Xdebug is disabled during execution, and added logic to escape single quotes in the command for safe shell execution.
  • Refactored isToolInstalled and tool validation logic to use the updated execDdev method instead of directly calling execSync, ensuring consistent behavior and Xdebug handling. [1] [2]

Testing improvements:

  • Added tests to confirm that execDdev wraps commands correctly with XDEBUG_MODE=off and that single quotes in commands are properly escaped.

Copy link

Copilot AI left a 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 the DdevUtils class to prevent performance issues caused by Xdebug during command execution by automatically disabling it with XDEBUG_MODE=off. The implementation wraps commands in a bash shell to set environment variables and properly escapes single quotes for safe execution.

  • Wraps all DDEV commands with bash -c 'XDEBUG_MODE=off ...' to disable Xdebug during execution
  • Implements proper single quote escaping using the '\'' pattern for safe shell execution
  • Refactors isToolInstalled and validateDdevTool to use the centralized execDdev method

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/shared/utils/ddev-utils.ts Updated execDdev to wrap commands with XDEBUG_MODE=off using bash, added single quote escaping, and refactored tool validation methods to use the updated execDdev
src/test/ddev-utils.test.ts Added tests verifying XDEBUG_MODE=off wrapping and proper escaping of single quotes in commands

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Morgy93 Morgy93 merged commit a90381b into main Dec 27, 2025
14 checks passed
@Morgy93 Morgy93 deleted the Morgy93/issue31 branch December 27, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants