Skip to content

Commit

Permalink
fix: ignore close listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 20, 2020
1 parent 21bf7c2 commit ae22387
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function createDevServer (sigmaContext: SigmaContext) {
})

// Listen
const listeners: Server[] = []
let listeners: Server[] = []
async function listen (port) {
port = await getPort({ name: 'nuxt' })
const listener = await new Promise<Server>((resolve, reject) => {
Expand Down Expand Up @@ -122,9 +122,10 @@ export function createDevServer (sigmaContext: SigmaContext) {
if (pendingWorker) {
await pendingWorker.terminate()
}
await Promise.all(listeners.map(l => new Promise((resolve, reject) => {
l.close(err => err ? reject(err) : resolve(undefined))
await Promise.all(listeners.map(l => new Promise((resolve) => {
l.close(() => resolve())
})))
listeners = []
}
sigmaContext._internal.hooks.hook('close', close)

Expand Down

0 comments on commit ae22387

Please sign in to comment.