diff --git a/commands/dev.js b/commands/dev.js index 84e45cc..dcae573 100644 --- a/commands/dev.js +++ b/commands/dev.js @@ -19,9 +19,15 @@ module.exports = async () => { lint(projectPath, pkg); - ['exit', 'SIGINT', 'SIGTERM'].forEach(event => - process.on(event, () => unlinkBin(projectPath)) - ); + ['exit', 'SIGINT', 'SIGTERM'].forEach(event => { + process.on(event, () => { + const {code} = unlinkBin(projectPath); + + if (event === 'SIGINT' || event === 'SIGTERM') { + process.exit(code ? 1 : 0); + } + }); + }); console.log(wrapAnsi(stripIndent(` ${chalk.bold('Development mode')} diff --git a/lib/unlink-bin.js b/lib/unlink-bin.js index d956e6d..a83ec22 100644 --- a/lib/unlink-bin.js +++ b/lib/unlink-bin.js @@ -5,5 +5,5 @@ const execa = require('execa'); module.exports = projectPath => { const bin = hasYarn(projectPath) ? 'yarn' : 'npm'; - return execa(bin, ['unlink']); + return execa.sync(bin, ['unlink']); };