Skip to content

Commit

Permalink
version output will not print extra newline
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Hiller committed Aug 30, 2014
1 parent 28a3805 commit a54d068
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ function Argv (processArgs, cwd) {
process.exit(0);
}
else if (key === versionOpt) {
console.log(version);
process.stdout.write(version);
process.exit(0);
}
});
Expand Down
3 changes: 3 additions & 0 deletions test/usage.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,10 +714,12 @@ describe('usage', function () {
process._exit = process.exit;
process._env = process.env;
process._argv = process.argv;
process.stdout._write = process.stdout.write;

process.exit = function () { exit = true };
process.env = Hash.merge(process.env, { _ : 'node' });
process.argv = [ './usage' ];
process.stdout.write = function (msg) { logs.push(msg) };

var errors = [];
var logs = [];
Expand All @@ -732,6 +734,7 @@ describe('usage', function () {
process.exit = process._exit;
process.env = process._env;
process.argv = process._argv;
process.stdout.write = process.stdout._write;

console.error = console._error;
console.log = console._log;
Expand Down

0 comments on commit a54d068

Please sign in to comment.