Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding committed Aug 13, 2023
1 parent 2d077f6 commit 8f977c9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/next/src/server/lib/router-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export async function initialize(opts: {

const cleanup = async (err: Error | undefined) => {
if (err) {
await devInstance?.logErrorWithOriginalStack(err)
await devInstance?.logErrorWithOriginalStack(err, 'uncaughtException')
}

debug('router-server process cleanup')
Expand Down
15 changes: 6 additions & 9 deletions packages/next/src/server/lib/setup-server-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ import '../node-polyfill-fetch'
import { warn } from '../../build/output/log'
import { Duplex } from 'stream'

// `pages` will be in the same process as the router
if (process.env.__NEXT_PRIVATE_RENDER_WORKER === 'app') {
process.on('unhandledRejection', (err) => {
console.error(err)
})
process.on('unhandledRejection', (err) => {
console.error(err)
})

process.on('uncaughtException', (err) => {
console.error(err)
})
}
process.on('uncaughtException', (err) => {
console.error(err)
})

export const WORKER_SELF_EXIT_CODE = 77

Expand Down
2 changes: 2 additions & 0 deletions packages/next/src/server/lib/start-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,11 @@ export async function startServer({
process.exit(1)
}

console.log(process.env.__NEXT_PRIVATE_RENDER_WORKER)
const cleanup = () => {
debug('start-server process cleanup')
server.close()
// process.exit(1)
}
process.on('exit', cleanup)
process.on('SIGINT', cleanup)
Expand Down

0 comments on commit 8f977c9

Please sign in to comment.