Skip to content

Commit

Permalink
Fix the value of $0 in the cli module.
Browse files Browse the repository at this point in the history
`process.argv[0]` is likely never going to equal exactly “node” since
it should be the full path to the node binary running the program.
Therefore we need to check that the basename is “node” and move on to
`argv[1]` if that’s the case.
  • Loading branch information
eventualbuddha committed Sep 12, 2015
1 parent e1368e9 commit d234451
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/cli.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/cli.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ output = (out) ->

# start processing options
if options.help
$0 = if process.argv[0] is 'node' then process.argv[1] else process.argv[0]
$0 = if path.basename(process.argv[0]) is 'node' then process.argv[1] else process.argv[0]
$0 = path.basename $0

console.log "
Expand Down

0 comments on commit d234451

Please sign in to comment.