Skip to content

Commit 562038a

Browse files
authored
Merge branch 'main' into sarahetter/remove-future-state-flag
2 parents 60cfa21 + 3a2da99 commit 562038a

File tree

5 files changed

+41
-15
lines changed

5 files changed

+41
-15
lines changed

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/build/src/plugins/spawn.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { createRequire } from 'module'
2+
import { platform } from 'os'
23
import { fileURLToPath, pathToFileURL } from 'url'
34
import { promisify } from 'util'
45

56
import { trace } from '@opentelemetry/api'
67
import { ExecaChildProcess, execaNode } from 'execa'
7-
import { gte } from 'semver'
8+
import { gte, satisfies } from 'semver'
89

910
import { FeatureFlags } from '../core/feature_flags.js'
1011
import { addErrorInfo } from '../error/info.js'
@@ -217,5 +218,17 @@ const stopPlugin = async function ({
217218
})
218219
childProcess.disconnect()
219220
}
220-
childProcess.kill()
221+
222+
// On Windows with Node 21+, there's a bug where attempting to kill a child process
223+
// results in an EPERM error. Ignore the error in that case.
224+
// See: https://github.com/nodejs/node/issues/51766
225+
// We also disable execa's `forceKillAfterTimeout` in this case
226+
// which can cause unhandled rejection.
227+
try {
228+
childProcess.kill('SIGTERM', {
229+
forceKillAfterTimeout: platform() === 'win32' && satisfies(process.version, '>=21') ? false : undefined,
230+
})
231+
} catch {
232+
// no-op
233+
}
221234
}

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import { platform } from 'os'
2+
13
import { ExecaChildProcess } from 'execa'
24
import fetch from 'node-fetch'
35
import waitFor from 'p-wait-for'
6+
import { satisfies } from 'semver'
47

58
// 1 second
69
const SERVER_KILL_TIMEOUT = 1e3
@@ -43,9 +46,19 @@ const killProcess = (ps: ExecaChildProcess<string>) => {
4346
ps.on('close', resolve)
4447
ps.on('error', reject)
4548

46-
ps.kill('SIGTERM', {
47-
forceKillAfterTimeout: SERVER_KILL_TIMEOUT,
48-
})
49+
// On Windows with Node 21+, there's a bug where attempting to kill a child process
50+
// results in an EPERM error. Ignore the error in that case.
51+
// See: https://github.com/nodejs/node/issues/51766
52+
// We also disable execa's `forceKillAfterTimeout` in this case
53+
// which can cause unhandled rejection.
54+
try {
55+
ps.kill('SIGTERM', {
56+
forceKillAfterTimeout:
57+
platform() === 'win32' && satisfies(process.version, '>=21') ? false : SERVER_KILL_TIMEOUT,
58+
})
59+
} catch {
60+
// no-op
61+
}
4962
})
5063
}
5164

packages/js-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"node client"
4242
],
4343
"dependencies": {
44-
"@netlify/open-api": "^2.34.0",
44+
"@netlify/open-api": "^2.35.0",
4545
"lodash-es": "^4.17.21",
4646
"micro-api-client": "^3.3.0",
4747
"node-fetch": "^3.0.0",

packages/zip-it-and-ship-it/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@babel/parser": "^7.22.5",
4545
"@babel/types": "7.25.6",
4646
"@netlify/binary-info": "^1.0.0",
47-
"@netlify/serverless-functions-api": "^1.31.0",
47+
"@netlify/serverless-functions-api": "^1.31.1",
4848
"@vercel/nft": "^0.27.1",
4949
"archiver": "^7.0.0",
5050
"common-path-prefix": "^3.0.0",

0 commit comments

Comments
 (0)