未验证 提交 b6bb110a 编写于 作者: J JJ Kasper 提交者: GitHub

Ensure process exits after build completes (#23207)

This ensures we exit the build process after the build completes even if timers/connections are left open since this can cause the process to hang indefinitely. This was the previous behavior although got changed un-intentionally in https://github.com/vercel/next.js/commit/e27b7e996d6e7e6772272f3d189ce93dac25fc3d

This updates our production test with an open timer to ensure it doesn't block the process from completing. 
上级 e2cdf6d5
......@@ -106,7 +106,15 @@ if (typeof React.Suspense === 'undefined') {
process.on('SIGTERM', () => process.exit(0))
process.on('SIGINT', () => process.exit(0))
commands[command]().then((exec) => exec(forwardedArgs))
commands[command]()
.then((exec) => exec(forwardedArgs))
.then(() => {
if (command === 'build') {
// ensure process exits after build completes so open handles/connections
// don't cause process to hang
process.exit(0)
}
})
if (command === 'dev') {
const { CONFIG_FILE } = require('../next-server/lib/constants')
......
// intervals/open connections shouldn't block build from exiting
setInterval(() => {}, 250)
module.exports = {
onDemandEntries: {
// Make sure entries are not getting disposed.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册