Skip to content

Commit fe804d9

Browse files
committed
_Partial_ backslash support in node.js argv directory munging
Doesn't do it when node is started from another drive using a drive-relative path. E.g: d: cd nodejs c: d:node.exe d:test.js
1 parent 9be07f7 commit fe804d9

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/node.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,14 +530,16 @@
530530
var path = requireNative('path');
531531

532532
// Make process.argv[0] and process.argv[1] into full paths.
533-
if (process.argv[0].indexOf('/') > 0) {
533+
if ('/\\'.indexOf(process.argv[0].charAt(0)) < 0
534+
&& process.argv[0].charAt(1) != ':') {
534535
process.argv[0] = path.join(cwd, process.argv[0]);
535536
}
536537

537538
if (process.argv[1]) {
538539
// Load module
539-
if (process.argv[1].charAt(0) != '/' &&
540-
!(/^http:\/\//).exec(process.argv[1])) {
540+
if ('/\\'.indexOf(process.argv[1].charAt(0)) < 0
541+
&& process.argv[1].charAt(1) != ':'
542+
&& !(/^http:\/\//).exec(process.argv[1])) {
541543
process.argv[1] = path.join(cwd, process.argv[1]);
542544
}
543545
// REMOVEME: nextTick should not be necessary. This hack to get

0 commit comments

Comments
 (0)