Skip to content

Commit cc16b6c

Browse files
committed
Exit when command rejects a promise
1 parent b532ba0 commit cc16b6c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/plugin-api.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,21 @@ export default class PluginAPI {
257257
}
258258
};
259259
_commandErrorHandler(e) {
260+
log('_commandErrorHandler');
260261
process.exitCode = 1;
261262

262263
// Only show error when not from nodemiral
263264
// since nodemiral would have already shown the error
264265
if (!(e.nodemiralHistory instanceof Array)) {
266+
log('_commandErrorHandler: nodemiral error');
265267
console.error(e.stack || e);
266268
}
267269

268270
if (e.solution) {
269271
console.log(chalk.yellow(e.solution));
270272
}
273+
274+
process.exit(1);
271275
}
272276
runCommand = async function(name) {
273277
if (!name) {
@@ -284,7 +288,6 @@ export default class PluginAPI {
284288
potentialPromise = commands[name].handler(this, nodemiral);
285289
} catch (e) {
286290
this._commandErrorHandler(e);
287-
process.exit(1);
288291
}
289292

290293
if (potentialPromise && typeof potentialPromise.then === 'function') {

0 commit comments

Comments
 (0)