@@ -129,16 +129,16 @@ function mungeSh (workingDir, options) {
129
129
}
130
130
131
131
function isCmd ( file ) {
132
- var comspec = path . basename ( process . env . comspec || '' , '.exe ' )
133
- return isWindows && ( file === comspec || / ^ c m d ( \. e x e ) ? $ / . test ( file ) )
132
+ var comspec = path . basename ( process . env . comspec || '' ) . replace ( / \. e x e $ / i , '' )
133
+ return isWindows && ( file === comspec || / ^ c m d ( \. e x e | \. E X E ) ? $ / . test ( file ) )
134
134
}
135
135
136
136
function mungeCmd ( workingDir , options ) {
137
137
var cmdi = options . args . indexOf ( '/c' )
138
138
if ( cmdi === - 1 )
139
139
return
140
140
141
- var re = / ^ \s * ( " * ) ( [ ^ " ] * ?\b (?: n o d e | i o j s ) (?: \. e x e ) ? ) ( " * ) ( .* ) ? $ /
141
+ var re = / ^ \s * ( " * ) ( [ ^ " ] * ?\b (?: n o d e | i o j s ) (?: \. e x e | \. E X E ) ? ) ( " * ) ( .* ) ? $ /
142
142
var npmre = / ^ \s * ( " * ) ( [ ^ " ] * ?\b (?: n p m ) ) ( " * ) ( | $ ) /
143
143
var path_ = require ( 'path' )
144
144
if ( path_ . win32 )
@@ -173,13 +173,13 @@ function mungeCmd (workingDir, options) {
173
173
}
174
174
175
175
function isNode ( file ) {
176
- var cmdname = path . basename ( process . execPath , '.exe ' )
176
+ var cmdname = path . basename ( process . execPath ) . replace ( / \. e x e $ / i , '' )
177
177
return file === 'node' || file === 'iojs' || cmdname === file
178
178
}
179
179
180
180
function mungeNode ( workingDir , options ) {
181
181
options . originalNode = options . file
182
- var command = path . basename ( options . file , '.exe ' )
182
+ var command = path . basename ( options . file ) . replace ( / \. e x e $ / i , '' )
183
183
// make sure it has a main script.
184
184
// otherwise, just let it through.
185
185
var a = 0
@@ -303,7 +303,7 @@ function mungenpm (workingDir, options) {
303
303
}
304
304
305
305
function munge ( workingDir , options ) {
306
- options . basename = path . basename ( options . file , '.exe ' )
306
+ options . basename = path . basename ( options . file ) . replace ( / \. e x e $ / i , '' )
307
307
308
308
// XXX: dry this
309
309
if ( isSh ( options . basename ) ) {
@@ -420,7 +420,7 @@ function setup (argv, env) {
420
420
fs . chmodSync ( workingDir + '/node' , '0755' )
421
421
fs . writeFileSync ( workingDir + '/iojs' , shim )
422
422
fs . chmodSync ( workingDir + '/iojs' , '0755' )
423
- var cmdname = path . basename ( process . execPath , '.exe ' )
423
+ var cmdname = path . basename ( process . execPath ) . replace ( / \. e x e $ / i , '' )
424
424
if ( cmdname !== 'iojs' && cmdname !== 'node' ) {
425
425
fs . writeFileSync ( workingDir + '/' + cmdname , shim )
426
426
fs . chmodSync ( workingDir + '/' + cmdname , '0755' )
0 commit comments