env-js icon indicating copy to clipboard operation
env-js copied to clipboard

Settings problem with Ruby 1.9 and TheRubyRacer V8.

Open falaise opened this issue 14 years ago • 1 comments

Hello,

With this little script :

puts " ARGV_0 <#{ARGV.join(", ")}> (#{ARGV.class})" ["foo",2,3,4].each{|p| ARGV.push p} puts " ARGV_1 <#{ARGV.join(", ")}> (#{ARGV.class})" begin puts " $FILENAME <#{$FILENAME}> (#{$FILENAME.class})" rescue => ex puts " *** EXCEPTION <#{ex.message}>\n STACK=<#{ex.backtrace.join("\n")}>" end puts " ARGV_2 <#{ARGV.join(", ")}> (#{ARGV.class})"

If you start it with Ruby 1.8 you will have : ARGV_0 <> (Array) ARGV_1 <foo, 2, 3, 4> (Array) $FILENAME <-> (String) ARGV_2 <foo, 2, 3, 4> (Array) which is right and works with 'bin/envjs rubyracer foo.js' as written in the last line of 'envjs/rubyracer.rb'.

but if you try it with Ruby 1.9 you will have : ARGV_0 <> (Array) ARGV_1 <foo, 2, 3, 4> (Array) *** EXCEPTION <No such file or directory - foo> STACK=<./this_script.rb:XX:in `

'> ARGV_2 <2, 3, 4> (Array) which does not work with 'bin/envjs rubyracer foo.js' as written in the last line of 'envjs/rubyracer.rb'.

I suggest to ignore the global variable '$FILENAME' Probably you have that problem with all JavaScript engines and Ruby.

Regards.

falaise avatar May 11 '11 11:05 falaise

Thanks!

Sent from my iPhone Christopher Thatcher 202-340-9685 [email protected]

On May 11, 2011, at 7:05 AM, [email protected] wrote:

Hello,

With this little script :

puts " ARGV_0 <#{ARGV.join(", ")}> (#{ARGV.class})" ["foo",2,3,4].each{|p| ARGV.push p} puts " ARGV_1 <#{ARGV.join(", ")}> (#{ARGV.class})" begin puts " $FILENAME <#{$FILENAME}> (#{$FILENAME.class})" rescue => ex puts " *** EXCEPTION <#{ex.message}>\n STACK=<#{ex.backtrace.join("\n")}>" end puts " ARGV_2 <#{ARGV.join(", ")}> (#{ARGV.class})"

If you start it with Ruby 1.8 you will have : ARGV_0 <> (Array) ARGV_1 <foo, 2, 3, 4> (Array) $FILENAME <-> (String) ARGV_2 <foo, 2, 3, 4> (Array) which is right and works with 'bin/envjs rubyracer foo.js' as written in the last line of 'envjs/rubyracer.rb'.

but if you try it with Ruby 1.9 you will have : ARGV_0 <> (Array) ARGV_1 <foo, 2, 3, 4> (Array) *** EXCEPTION <No such file or directory - foo> STACK=<./this_script.rb:XX:in `

'> ARGV_2 <2, 3, 4> (Array) which does not work with 'bin/envjs rubyracer foo.js' as written in the last line of 'envjs/rubyracer.rb'.

I suggest to ignore the global variable '$FILENAME' Probably you have that problem with all JavaScript engines and Ruby.

Regards.

Reply to this email directly or view it on GitHub: https://github.com/thatcher/env-js/issues/34

thatcher avatar May 11 '11 21:05 thatcher