Skip to content

Commit cb8707a

Browse files
elidoranaeschright
authored andcommitted
Reduce work to test if executable ends with a 'g'. (#138)
PR-URL: #138 Credit: @elidoran Reviewed-By: @aeschright
1 parent 1305bb6 commit cb8707a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

bin/npm-cli.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
unsupported.checkForUnsupportedNode()
2727

28-
var path = require('path')
2928
var npm = require('../lib/npm.js')
3029
var npmconf = require('../lib/config/core.js')
3130
var errorHandler = require('../lib/utils/error-handler.js')
@@ -37,7 +36,7 @@
3736

3837
// if npm is called as "npmg" or "npm_g", then
3938
// run in global mode.
40-
if (path.basename(process.argv[1]).slice(-1) === 'g') {
39+
if (process.argv[1][process.argv[1].length - 1] === 'g') {
4140
process.argv.splice(1, 1, 'npm', '-g')
4241
}
4342

0 commit comments

Comments
 (0)