Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

Commit

Permalink
fix(docz-core): kill server on signals
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Nov 15, 2018
1 parent 210c3a1 commit be0855f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/docz-core/src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export const dev = async (args: Config) => {

const bundlerConfig = await bundler.getConfig(env)
const server = await bundler.createServer(bundlerConfig)
const { app } = await server.start()
const instance = await server.start()
const dataServer = new DataServer(
app.server,
instance.app.server,
websocketPort,
config.websocketHost
)
Expand All @@ -47,4 +47,12 @@ export const dev = async (args: Config) => {
logger.fatal('Failed to process your server:', err)
process.exit(1)
}

const signals: any = ['SIGINT', 'SIGTERM']
for (const sig of signals) {
process.on(sig, async () => {
instance.close()
process.exit()
})
}
}

0 comments on commit be0855f

Please sign in to comment.