Skip to content

Instantly share code, notes, and snippets.

@aaronj1335
Created June 27, 2012 14:39
Show Gist options
  • Select an option

  • Save aaronj1335/3004474 to your computer and use it in GitHub Desktop.

Select an option

Save aaronj1335/3004474 to your computer and use it in GitHub Desktop.
improper handling of command line arguments in node 0.8.0
echo 'console.log(process.argv);' > test.js
node test.js /static
# prints out ['C\\:Program Files\\nodejs\\node.exe', 'C:\\Users\\astacy\\code\\daft\\test.js', 'C:/Program Files/Git/static']
node test.js /static
REM prints out ['node', 'C:\\Users\\astacy\\code\\daft\\test.js', '/static']
@aaronj1335
Copy link
Copy Markdown
Author

the problem is that when i run the same command in the git-bash shell (mingw) and the command prompt:

$ node test.js /static

i get two different results for the last command line argument, 'C:/Program Files/Git/static' in git-bash (which is incorrect, but i need git-bash for my dev environment) and '/static' in windows command prompt (which is correct, but is of no use to me).

at first i figured this was a problem with my mingw environment, but then running echo /static works correctly in mingw -- it prints out '/static' instead of the full path rooted at C:/

how do i get run_in_mingw.sh to work correctly in the git-bash shell?

@aaronj1335
Copy link
Copy Markdown
Author

also, this behavior started when i upgraded to 0.8.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment