Set process.argv[0] to 'coffee' when using coffee foo.coffee
#1303
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed at #1301 (and several other issues Michael linked to from there), the current behavior of
process.argv
is to preserve'node'
as the first array value. I wasn't convinced that this mattered when the issue was first raised, but I've since come around. The very purpose ofargv
is that it tells you how to run the current program; if you runand
process.argv
isthen you can't do that. It's internally inconsistent, and in practical terms, it means you can't use raw
coffee
files with libraries like multi-node (see #1283) and Cluster, which useprocess.argv
to fork processes. Granted, it's a good practice to compile to JS before deployment in such an environment, but there are circumstances under which usingcoffee
files directly is much more convenient. I see no advantage to the current behavior.