diff --git a/extensions/inference-nitro-extension/src/module.ts b/extensions/inference-nitro-extension/src/module.ts index d69cba9c3..1c4b23fde 100644 --- a/extensions/inference-nitro-extension/src/module.ts +++ b/extensions/inference-nitro-extension/src/module.ts @@ -188,18 +188,15 @@ async function validateModelStatus(): Promise { * @returns A Promise that resolves when the subprocess is terminated successfully, or rejects with an error message if the subprocess fails to terminate. */ function killSubprocess(): Promise { - if (subprocess) { - return fetch(NITRO_HTTP_KILL_URL, { - method: "DELETE", - }).catch((err) => { - console.error(err); - subprocess.kill(); - subprocess = null; - return kill(PORT, "tcp").then(console.log).catch(console.log); -}); - } else { - return kill(PORT, "tcp").then(console.log).catch(console.log); - } + fetch(NITRO_HTTP_KILL_URL, { + method: "DELETE", + }).catch((err) => { + console.error(err); + subprocess?.kill(); + kill(PORT, "tcp").then(console.log).catch(console.log); + subprocess = null; + }); + return } /**