Dale, On Thu, 2006-06-22 at 06:18 +0900, Dale Martenson wrote: > Philip Rhoades wrote: > > Dale, > > > > Something odd here - see below . . > > > > > > On Tue, 2006-06-20 at 23:54 +0900, Dale Martenson wrote: > >> >> > >> > Debug.rb > >> > . > >> > require 'ftools' (line 6) > >> you could share the source. Or could you reduce the program down to a > >> prefix. The input is just the program source itself. > >> puts "BUBBA END." > >> > >> /usr/lib/ruby/1.8/ftools.rb:15: def syscopy from, to > >> (rdb:1) s > >> /usr/lib/ruby/1.8/ftools.rb:150: alias o_chmod chmod > >> d.rb:5:$stdin.each_line do |line| > >> d.rb:6: puts "BUBBA: "+line > >> BUBBA: end > >> You should attempt to step through your program to see what happens. You > >> may want to turn on trace. > > > > > > [root@prix bin]# ruby -r debug debugtst.rb > > Debug.rb > > Emacs support available. > > > > debugtst.rb:3:require 'ftools' > > (rdb:1) $stdin = IO.popen( "cat debugtst.rb" ) > > #<IO:0xb7f676c8> > > (rdb:1) #!/usr/bin/env ruby > > nil > > (rdb:1) > > #!/usr/bin/env ruby > > nil > > (rdb:1) require 'ftools' > > true > > (rdb:1) > > require 'ftools' > > false > > (rdb:1) $stdin.each_line do |line| > > debugtst.rb:3:compile error > > debugtst.rb:3: syntax error, unexpected $end > > $stdin.each_line do |line| > > ^ > > (rdb:1) puts "BUBBA: "+line > > debugtst.rb:3:undefined local variable or method `line' for main:Object > > (rdb:1) end > > debugtst.rb:3:compile error > > debugtst.rb:3: syntax error, unexpected kEND > > (rdb:1) puts "BUBBA END." > > BUBBA END. > > nil > > (rdb:1) > > puts "BUBBA END." > > BUBBA END. > > nil > > (rdb:1) > > puts "BUBBA END." > > BUBBA END. > > nil > > (rdb:1) > > puts "BUBBA END." > > BUBBA END. > > nil > > (rdb:1) > > > > > > I don't get the chance to step . . it looks like something peculiar to > > my system (FC5 + latest Ruby) . . any idea what? > > > > What version of ruby are you using? ruby-1.8.4-6.fc5 > I happened to be using 1.8.2 (not > the latest and greatest, but darn good none the less). It is like it is > not letting you redefine $stdin. Once you do, it takes the input to the > debugger from the piped input which is not what you want. Is this a > difference between using readline or not for IRB. readline-5.0-3.2.1 > I don't think so and I > would assume you are using readline for IRB. I also tried it on an > older machine of mine that is running a 1.8.1 version of Ruby that > doesn't have readline and it worked as I would expect. > > Weird? Yep, it's got me stumped . . but I have never used the Ruby debugger before and I thought I might be doing something dumb . . Thanks, Phil. -- Philip Rhoades Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275) GPO Box 3411 Sydney NSW 2001 Australia Mobile: +61:(0)411-185-652 Fax: +61:(0)2-8221-9599 E-mail: phil / pricom.com.au