Skip to content

Commit

Permalink
improve handling of process exit
Browse files Browse the repository at this point in the history
  • Loading branch information
FredKSchott committed Jun 3, 2020
1 parent e5161c0 commit 3ffb036
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -83,6 +83,7 @@
"resolve-from": "^5.0.0",
"rimraf": "^3.0.0",
"rollup": "^2.3.0",
"signal-exit": "^3.0.3",
"strip-comments": "^2.0.1",
"tar": "^6.0.1",
"validate-npm-package-name": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/commands/dev.ts
Expand Up @@ -38,6 +38,7 @@ import npmRunPath from 'npm-run-path';
import os from 'os';
import path from 'path';
import url from 'url';
import onProcessExit from 'signal-exit';
import detectPort from 'detect-port';
import {BuildScript, SnowpackPluginBuildResult} from '../config';
import {EsmHmrEngine} from '../hmr-server-engine';
Expand Down Expand Up @@ -777,9 +778,8 @@ export async function command(commandOptions: CommandOptions) {
watcher.on('change', (fileLoc) => onWatchEvent(fileLoc));
watcher.on('unlink', (fileLoc) => onWatchEvent(fileLoc));

process.on('SIGINT', () => {
onProcessExit(() => {
hmrEngine.disconnectAllClients();
process.exit(0);
});

console.log = (...args) => {
Expand Down

0 comments on commit 3ffb036

Please sign in to comment.