MCPcopy
hub / github.com/vitejs/vite / killProcess

Function killProcess

playground/test-utils.ts:433–446  ·  view source on GitHub ↗
(
  serverProcess: ExecaResultPromise,
)

Source from the content-addressed store, hash-verified

431
432// helper function to kill process, uses taskkill on windows to ensure child process is killed too
433export async function killProcess(
434 serverProcess: ExecaResultPromise,
435): Promise<void> {
436 if (isWindows) {
437 try {
438 const { execaCommandSync } = await import('execa')
439 execaCommandSync(`taskkill /pid ${serverProcess.pid} /T /F`)
440 } catch (e) {
441 console.error('failed to taskkill:', e)
442 }
443 } else {
444 serverProcess.kill('SIGTERM')
445 }
446}
447
448export interface PromiseWithResolvers<T> {
449 promise: Promise<T>

Callers 2

closeFunction · 0.85
closeFunction · 0.85

Calls 1

errorMethod · 0.65

Tested by 2

closeFunction · 0.68
closeFunction · 0.68