mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
fix: ignore close listeners
This commit is contained in:
parent
6080927c16
commit
bde0c7c286
@ -86,7 +86,7 @@ export function createDevServer (sigmaContext: SigmaContext) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Listen
|
// Listen
|
||||||
const listeners: Server[] = []
|
let listeners: Server[] = []
|
||||||
async function listen (port) {
|
async function listen (port) {
|
||||||
port = await getPort({ name: 'nuxt' })
|
port = await getPort({ name: 'nuxt' })
|
||||||
const listener = await new Promise<Server>((resolve, reject) => {
|
const listener = await new Promise<Server>((resolve, reject) => {
|
||||||
@ -122,9 +122,10 @@ export function createDevServer (sigmaContext: SigmaContext) {
|
|||||||
if (pendingWorker) {
|
if (pendingWorker) {
|
||||||
await pendingWorker.terminate()
|
await pendingWorker.terminate()
|
||||||
}
|
}
|
||||||
await Promise.all(listeners.map(l => new Promise((resolve, reject) => {
|
await Promise.all(listeners.map(l => new Promise((resolve) => {
|
||||||
l.close(err => err ? reject(err) : resolve(undefined))
|
l.close(() => resolve())
|
||||||
})))
|
})))
|
||||||
|
listeners = []
|
||||||
}
|
}
|
||||||
sigmaContext._internal.hooks.hook('close', close)
|
sigmaContext._internal.hooks.hook('close', close)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user