From ce90620165acd20e577ff9f5ed96f2cf04730e54 Mon Sep 17 00:00:00 2001 From: Pablo Bendersky Date: Fri, 11 Jul 2025 11:01:27 -0300 Subject: [PATCH] Fixed kill command to work properly on linux --- src/utils/port.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/port.ts b/src/utils/port.ts index 0e388df..828955b 100644 --- a/src/utils/port.ts +++ b/src/utils/port.ts @@ -19,7 +19,7 @@ export function killProcessOnPort(port: number) { `FOR /F "tokens=5" %a in ('netstat -ano ^| findstr :${port}') do taskkill /F /PID %a`, ); } else { - execSync(`lsof -ti:${port} | xargs kill -9`); + execSync(`pids=$(lsof -ti:${port} 2>/dev/null) && [ -n "$pids" ] && echo "$pids" | xargs kill -9 || true`); } } catch (error) { console.error(`Failed to kill process on port ${port}:`, error);