From 21b47cf7a3f88e690df8ca4a17104f65a11ba96f Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Thu, 17 Jan 2019 17:01:45 +0200 Subject: [PATCH] fixup signal handling for ncc run --- src/cli.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/cli.js b/src/cli.js index 6de6a6149..e543f9c18 100755 --- a/src/cli.js +++ b/src/cli.js @@ -236,7 +236,15 @@ switch (args._[0]) { ? ["-r", resolve(__dirname, "sourcemap-register")] : [] }); - ps.on("close", () => require("rimraf").sync(outDir)); + function exit () { + require("rimraf").sync(outDir); + process.exit(); + } + ps.on("exit", () => { + require("rimraf").sync(outDir); + }); + process.on("SIGTERM", exit); + process.on("SIGINT", exit); } } if (args["--watch"]) {