veged / coa

Command-Option-Argument: Get more from defining your command line interface
MIT License
144 stars 22 forks source link

Keep exit code from outer scope #89

Closed gfranco closed 6 years ago

gfranco commented 6 years ago

Not sure is it a bug, but coa doesn't keep an exit code if process.exit was called somewhere outside.

process.once('uncaughtException', () => {
  process.exit(1);
});

setTimeout(() => {
  throw Error('0_o');
}, 500);

require('coa').Cmd()
  .name('Ololo').title('Ololo')
  .act(() => {
    setTimeout(() => console.log('OK'), 1000);
  })
  .run(process.argv.slice(2));

Expected Result: Exit code 1

Actual Result: Exit code 0

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 69.714% when pulling 54ff3f6d0f2010592cbc3cf68ff1e0c89fd56ee6 on gfranco:patch-1 into 05bd8dd95703ce2284169928b52dfe28204b72e7 on veged:master.

qfox commented 6 years ago

Thank you very much, I'll try to publish this asap.

qfox commented 6 years ago

Published in 2.0.1