From: nobu.nokada@... Date: 2003-09-05T19:56:32+09:00 Subject: Re: [bug] Silent death of "ruby -e" Hi, At Fri, 5 Sep 2003 19:43:36 +0900, Johan Holmberg wrote: > I've found a weird bug. It can occur when running Ruby 1.8 with the > "-e" option on Windows. Like this: > > $ ruby -e 'puts foo' > -e:1: undefined local variable or method `foo' for main:Object (NameError) > $ > $ ruby -e 'puts foo[1]' > -e:1: undefined local variable or method `foo' for main:Object (NameError) > $ > * $ ruby -e 'puts foo["a"]' > $ > $ ruby -e 'puts foo["a"] ; puts "never-written"' > -e:1: undefined local variable or method `foo' for main:Object (NameError) > $ > > I think that the third line above (marked with a *) should have > given an error too. It seems to depend on the shell. You run mswin or mingw ruby from cygwin bash, no? In such case; $ ./ruby -v -I ext/nodedump/ -rNodeDump -e 'puts foo["1"]' ruby 1.8.0 (2003-09-05) [i386-mswin32] NodeDump V0.9 NODE_NEWLINE: [-e:1] NODE_STR: "puts foo[\"1\"]" -e:1: warning: useless use of a literal in void context However, from cmd.exe; > ruby -v -I ext/nodedump/ -rNodeDump -e 'puts foo["1"]' ruby 1.8.0 (2003-09-05) [i386-mswin32] NodeDump V0.9 NODE_NEWLINE: [-e:1] NODE_FCALL: to function: 6929 (puts) Parameters: NODE_ARRAY: size = 1 NODE_CALL: to method: 331 ([]) Receiver: NODE_VCALL: self.foo Parameters: NODE_ARRAY: size = 1 NODE_STR: "1" -- Nobu Nakada