Skip to content

Commit

Permalink
Wait for the close event, write our help information, then give other…
Browse files Browse the repository at this point in the history
… events a chance to write something, and then ask to destroySoon the stdout stream.

Signed-off-by: Tj Holowaychuk <tj@vision-media.ca>
  • Loading branch information
jhamlet authored and tj committed Nov 14, 2011
1 parent fca696a commit f941344
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/commander.js
Expand Up @@ -902,9 +902,10 @@ function pad(str, width) {

exports.option('-h, --help', 'output usage information');
exports.on('help', function(){
process.stdout.on("drain", function () {
process.exit(0);
process.stdout.on("close", function () {
process.exit(0);
});
process.stdout.write(this.helpInformation());
exports.emit('--help');
process.stdout.destroySoon();
});

0 comments on commit f941344

Please sign in to comment.