From b708cb993994fe6a2353bf64e58a4b1863d47517 Mon Sep 17 00:00:00 2001 From: Garry Trinder Date: Thu, 22 May 2025 17:09:55 -0700 Subject: [PATCH] Improve Dev Proxy process detection. Closes #245 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #245 --- CHANGELOG.md | 1 + src/detect.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b27cb33..9879f0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Snippets: Updated all snippets to use `v0.28.0` schema - Commands: Removed configuration commands from editor +- Detection: Improved detection of Dev Proxy processes ### Fixed: diff --git a/src/detect.ts b/src/detect.ts index 2925b03..019bde5 100644 --- a/src/detect.ts +++ b/src/detect.ts @@ -54,11 +54,11 @@ export const isDevProxyRunning = async (devProxyExe: string): Promise = return processId.trim() !== ''; }; if (platform === 'darwin') { - const processId = await executeCommand(`$SHELL -c "ps -ef | grep ${devProxyExe} | grep -v grep | awk '{print $2}'"`); + const processId = await executeCommand(`$SHELL -c "ps -e -o pid=,comm= | awk \'\\$2==\"${devProxyExe}\" {print \\$1}\'"`); return processId.trim() !== ''; }; if (platform === 'linux') { - const processId = await executeCommand(`/bin/bash -c "ps -ef | grep ${devProxyExe} | grep -v grep | awk '{print $2}'"`); + const processId = await executeCommand(`/bin/bash -c "ps -e -o pid=,comm= | awk \'\\$2==\"${devProxyExe}\" {print \\$1}\'"`); return processId.trim() !== ''; } return false;