Skip to content

Commit f0ff5e6

Browse files
committed
fix: ignore plugin process kill errors
1 parent ef92c48 commit f0ff5e6

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

packages/build/src/plugins/spawn.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,5 +217,11 @@ const stopPlugin = async function ({
217217
})
218218
childProcess.disconnect()
219219
}
220-
childProcess.kill()
220+
try {
221+
childProcess.kill()
222+
} catch {
223+
// In Node 22, there's a bug where attempting to kill a child process
224+
// results in an EPERM error. Ignore the error in that case.
225+
// See: https://github.com/nodejs/node/issues/51766
226+
}
221227
}

packages/edge-bundler/node/server/util.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,15 @@ const killProcess = (ps: ExecaChildProcess<string>) => {
4343
ps.on('close', resolve)
4444
ps.on('error', reject)
4545

46-
ps.kill('SIGTERM', {
47-
forceKillAfterTimeout: SERVER_KILL_TIMEOUT,
48-
})
46+
try {
47+
ps.kill('SIGTERM', {
48+
forceKillAfterTimeout: SERVER_KILL_TIMEOUT,
49+
})
50+
} catch {
51+
// In Node 22, there's a bug where attempting to kill a child process
52+
// results in an EPERM error. Ignore the error in that case.
53+
// See: https://github.com/nodejs/node/issues/51766
54+
}
4955
})
5056
}
5157

0 commit comments

Comments
 (0)