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"]) {