MCPcopy
hub / github.com/vercel/next.js / stop

Method stop

test/lib/next-modes/base.ts:558–587  ·  view source on GitHub ↗
(
    signal: 'SIGINT' | 'SIGTERM' | 'SIGKILL' = 'SIGKILL'
  )

Source from the content-addressed store, hash-verified

556 public async start(options?: { skipBuild?: boolean }): Promise<void> {}
557
558 public async stop(
559 signal: 'SIGINT' | 'SIGTERM' | 'SIGKILL' = 'SIGKILL'
560 ): Promise<void> {
561 if (this.childProcess) {
562 if (this.isStopping !== null) {
563 // warn for debugging, but don't prevent sending two signals in succession
564 // (e.g. SIGINT and then SIGKILL)
565 require('console').error(
566 `Next server is already being stopped (received signal: ${signal}): `,
567 this.isStopping
568 )
569 }
570 this.isStopping = Error()
571 Error.captureStackTrace(this.isStopping, this.stop)
572 const closePromise = once(this.childProcess, 'close')
573 await new Promise<void>((resolve) => {
574 treeKill(this.childProcess!.pid!, signal, (err) => {
575 if (err) {
576 require('console').error('tree-kill', err)
577 }
578 resolve()
579 })
580 })
581 this.childProcess.kill(signal)
582 await closePromise
583 this.childProcess = undefined
584 this.isStopping = null
585 require('console').log(`Stopped next server`)
586 }
587 }
588
589 public async destroy(): Promise<void> {
590 try {

Callers 15

destroyMethod · 0.95
runTestsFunction · 0.45
index.test.tsFile · 0.45
index.test.tsFile · 0.45
hmr-iframe.test.tsFile · 0.45
ssr-in-rsc.test.tsFile · 0.45

Calls 7

onceFunction · 0.90
errorMethod · 0.65
killMethod · 0.65
requireFunction · 0.50
ErrorFunction · 0.50
resolveFunction · 0.50
logMethod · 0.45

Tested by 3

runTestsFunction · 0.36
setupNextFunction · 0.36
executeFunction · 0.36