Skip to content

Commit 5e83301

Browse files
committed
Trap unhandled failures
If an exception escapes from the main `cli()` function, we don't handle it. On Node < 16 that results in a successful process exit code even though the process has crashed. On Node >= 16 this was not a bug because of the stricter handling of unhandled promise rejections. You can demonstrate the bug by putting a string in `ember-addon.paths` in your app's package.json file. (It's supposed to be an array, and will cause a crash.)
1 parent 51b46cc commit 5e83301

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

bin/ember

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,7 @@ cli({
4242

4343
logger.info('Quitting "ember-cli" with exit code: %j', exitCode);
4444
exit(exitCode);
45+
}, function(err) {
46+
console.log(err);
47+
process.exit(-1);
4548
});

0 commit comments

Comments
 (0)