Skip to content

Commit

Permalink
fix: Build exit non zero on failure (#153)
Browse files Browse the repository at this point in the history
* CLI: exit 1 on error

Previously, a build failure would print the webpack errors, but exit 0
(with an unhandled promise rejection warning).

Note: this was true on node 10, not sure of the other platforms.

* Linter fixes: throw error instead of process.exit()
  • Loading branch information
danielbeardsley authored and hayes committed Mar 9, 2022
1 parent bec0e9e commit 8b595f9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ const chalk = require('chalk');
const version = require('../package').version;
const {init} = require('./commands/init');

// Make sure we die if we have an unhandled rejection (like a webpack build
// failure)
process.on('unhandledRejection', (err) => {
console.error(err);
throw new Error(`[packer-cli] ${err}`);
});

switch (process.argv[2]) {
case 'init':
init(args);
Expand Down

0 comments on commit 8b595f9

Please sign in to comment.