Fixing process.argv[0] ... #1303

This commit is contained in:
Jeremy Ashkenas 2011-04-30 10:59:55 -04:00
parent 0ed8ae28e7
commit bf8fbc2c0e
4 changed files with 2 additions and 4 deletions

View File

@ -50,7 +50,6 @@
while (root.parent) {
root = root.parent;
}
process.argv[0] = 'coffee';
root.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.';
if (root.moduleCache) {
root.moduleCache = {};

View File

@ -50,6 +50,7 @@
opts.literals = sources.splice(1).concat(opts.literals);
}
process.ARGV = process.argv = process.argv.slice(0, 2).concat(opts.literals);
process.argv[0] = 'coffee';
return compileScripts();
};
compileScripts = function() {

View File

@ -59,9 +59,6 @@ exports.run = (code, options) ->
while root.parent
root = root.parent
# Set the process command to `coffee`
process.argv[0] = 'coffee'
# Set the filename.
root.filename = process.argv[1] =
if options.filename then fs.realpathSync(options.filename) else '.'

View File

@ -66,6 +66,7 @@ exports.run = ->
if opts.run
opts.literals = sources.splice(1).concat opts.literals
process.ARGV = process.argv = process.argv.slice(0, 2).concat opts.literals
process.argv[0] = 'coffee'
compileScripts()
# Asynchronously read in each CoffeeScript in a list of source files and