From 10344522b53aac43a21c9e182f3df3702bbb71cd Mon Sep 17 00:00:00 2001 From: Frank Dannhauer Date: Fri, 23 Apr 2021 11:45:31 +0200 Subject: [PATCH] fix: xdebug unable to connect to host when running wp-env in windows wsl2 --- packages/env/lib/init-config.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/env/lib/init-config.js b/packages/env/lib/init-config.js index 75175853704a64..1bfdee14f71996 100644 --- a/packages/env/lib/init-config.js +++ b/packages/env/lib/init-config.js @@ -131,8 +131,10 @@ ${ shouldInstallXdebug ? installXdebug( config.xdebug ) : '' } } function installXdebug( enableXdebug ) { - const isLinux = os.type() === 'Linux'; - // Discover client host does not appear to work on macOS with Docker. + const isLinux = + os.type() === 'Linux' && + ! /-microsoft-standard-WSL2$/.test( os.release() ); + // Discover client host does not appear to work on macOS and Windows WSL2 with Docker. const clientDetectSettings = isLinux ? 'xdebug.discover_client_host=true' : 'xdebug.client_host="host.docker.internal"';