fix: ignore close listeners

This commit is contained in:
Pooya Parsa 2020-11-20 03:34:15 +01:00
parent 6080927c16
commit bde0c7c286

View File

@ -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)