diff --git a/packages/core/src/shell/scripts/kill-by-port.js b/packages/core/src/shell/scripts/kill-by-port.js index 2738e79e..ba834ff2 100644 --- a/packages/core/src/shell/scripts/kill-by-port.js +++ b/packages/core/src/shell/scripts/kill-by-port.js @@ -3,7 +3,7 @@ const execute = Shell.execute const executor = { async windows (exec, { port }) { - const cmds = [`for /f "tokens=5" %a in ('netstat -aon ^| find ":${port}" ^| find "LISTENING"') do taskkill /f /pid %a`] + const cmds = [`for /f "tokens=5" %a in ('netstat -aon ^| find ":${port}" ^| find "LISTENING"') do (taskkill /f /pid %a & exit /B) `] // eslint-disable-next-line no-unused-vars const ret = await exec(cmds, { type: 'cmd' }) return true