From d01ec0475e74f096aef025b0cf90a2fbf0118faf Mon Sep 17 00:00:00 2001 From: David Alger Date: Tue, 25 Aug 2020 10:20:50 -0500 Subject: [PATCH] Updated checks for MS to quietly grep to avoid errors being printed on Darwin systems (no /proc on macOS) --- commands/debug.cmd | 2 +- commands/env.cmd | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/debug.cmd b/commands/debug.cmd index adab5871..d8d83849 100644 --- a/commands/debug.cmd +++ b/commands/debug.cmd @@ -11,7 +11,7 @@ WARDEN_ENV_DEBUG_CONTAINER=${WARDEN_ENV_DEBUG_CONTAINER:-php-debug} WARDEN_ENV_DEBUG_HOST=${WARDEN_ENV_DEBUG_HOST:-} if [[ ${WARDEN_ENV_DEBUG_HOST} == "" ]]; then - if [[ $OSTYPE =~ ^darwin || "$(< /proc/sys/kernel/osrelease)" == *Microsoft || "$(< /proc/sys/kernel/osrelease)" == *microsoft* ]]; then + if [[ $OSTYPE =~ ^darwin ]] || grep -sqi microsoft /proc/sys/kernel/osrelease; then WARDEN_ENV_DEBUG_HOST=host.docker.internal else WARDEN_ENV_DEBUG_HOST=$( diff --git a/commands/env.cmd b/commands/env.cmd index 87cd6fba..fb85ccde 100644 --- a/commands/env.cmd +++ b/commands/env.cmd @@ -29,7 +29,8 @@ if [[ ${WARDEN_ENV_TYPE} == "magento2" ]]; then WARDEN_RABBITMQ=${WARDEN_RABBITMQ:-1} fi -if [[ ${XDEBUG_CONNECT_BACK_HOST} == '' && "$(< /proc/sys/kernel/osrelease)" == *microsoft* ]]; then +## WSL1/WSL2 are GNU/Linux env type but still run Docker Desktop +if [[ ${XDEBUG_CONNECT_BACK_HOST} == '' ]] && grep -sqi microsoft /proc/sys/kernel/osrelease; then export XDEBUG_CONNECT_BACK_HOST=host.docker.internal fi