I'm trying to run 'ruby -d foo.rb' and the d is either ignored or I don't understand how it works. The code just runs as if there is no -d option.
Does this require something at compile time of Ruby that I might have overlooked?
I'm trying to run 'ruby -d foo.rb' and the d is either ignored or I don't understand how it works. The code just runs as if there is no -d option.
Does this require something at compile time of Ruby that I might have overlooked?
Maybe you wanted ruby -rdebug -d foo.rb ?
On Aug 30, 2006, at 11:49 PM, Tom Allison wrote:
I'm trying to run 'ruby -d foo.rb' and the d is either ignored or I don't understand how it works. The code just runs as if there is no -d option.
Does this require something at compile time of Ruby that I might have overlooked?
I'm trying to run 'ruby -d foo.rb' and the d is either ignored or I don't
understand how it works. The code just runs as if there is no -d option.
"-d" sets $DEBUG to true.
Does your code execute something when $DEBUG is true?
For example:
puts "Important intermediate value: #{my_critical_var}" if $DEBUG
grrr.... that's not what the man pages, books, and everything else say...
On 8/31/2006, "Logan Capaldo" <logancapaldo@gmail.com> wrote:
On Aug 30, 2006, at 11:49 PM, Tom Allison wrote:
I'm trying to run 'ruby -d foo.rb' and the d is either ignored or I
don't understand how it works. The code just runs as if there is
no -d option.Does this require something at compile time of Ruby that I might
have overlooked?Maybe you wanted ruby -rdebug -d foo.rb ?
rickhg12hs wrote in post #131750:
I'm trying to run 'ruby -d foo.rb' and the d is either ignored or I don't
understand how it works. The code just runs as if there is no -d option."-d" sets $DEBUG to true.
Does your code execute something when $DEBUG is true?
For example:
puts "Important intermediate value: #{my_critical_var}" if $DEBUG
I was going nuts over this.
This file:
#!/usr/bin/env ruby
puts $DEBUG
prints false with or without ruby -d (e.g. ruby -d foo.rb)
So, the shebang line comes in the way in an unpredictable manner. The
workaround is to have export RUBYOPT=-d $RUBYOPT if you wanted shebang
line (and the easier invocation like: ./foo.rb after chmoding it).
If you are giving your file to the interpreter directly like: ruby
foo.rb (*and* you don't have shebang line in the file), then ruby -d
works as expected.
Bottom line: For such a simple thing, shebang line complicates life
(unnecessarily) at least on Linux
--
Posted via http://www.ruby-forum.com/\.
Well -d sets $DEBUG to true. -rdebug loads debug.rb which is the included debugger. The two are actually almost orthogonal most of the time you can do just ruby -rdebug foo.rb.
As far as what the man page says:
-d
--debug Turns on debug mode. $DEBUG will be set to true.
It doesn't say that it will also run a debugger
On Aug 31, 2006, at 2:11 PM, Tom Allison wrote:
grrr.... that's not what the man pages, books, and everything else say...
On 8/31/2006, "Logan Capaldo" <logancapaldo@gmail.com> wrote:
On Aug 30, 2006, at 11:49 PM, Tom Allison wrote:
I'm trying to run 'ruby -d foo.rb' and the d is either ignored or I
don't understand how it works. The code just runs as if there is
no -d option.Does this require something at compile time of Ruby that I might
have overlooked?Maybe you wanted ruby -rdebug -d foo.rb ?
hi,
what does this output:
require 'rbconfig'
puts "topdir #{RbConfig::CONFIG['topdir']}"
puts "RUBY_DESCRIPTION: #{RUBY_DESCRIPTION}"
in both the cases,
1) ruby <script.rb> without the shebang
2) ./script.rb with the shebang after chmodding it
also do you have multiple versions of ruby on your system. one managed
by RVM and a system installed one on your path?
cheers,
deepak
On Dec 21, 8:05 pm, Kedar Mhaswade <kedar.mhasw...@gmail.com> wrote:
rickhg12hs wrote in post #131750:
>> I'm trying to run 'ruby -d foo.rb' and the d is either ignored or I don't
>> understand how it works. The code just runs as if there is no -d option.> "-d" sets $DEBUG to true.
> Does your code execute something when $DEBUG is true?
> For example:
> puts "Important intermediate value: #{my_critical_var}" if $DEBUG
I was going nuts over this.
This file:
#!/usr/bin/env ruby
puts $DEBUGprints false with or without ruby -d (e.g. ruby -d foo.rb)
So, the shebang line comes in the way in an unpredictable manner. The
workaround is to have export RUBYOPT=-d $RUBYOPT if you wanted shebang
line (and the easier invocation like: ./foo.rb after chmoding it).If you are giving your file to the interpreter directly like: ruby
foo.rb (*and* you don't have shebang line in the file), then ruby -d
works as expected.Bottom line: For such a simple thing, shebang line complicates life
(unnecessarily) at least on Linux--
Posted viahttp://www.ruby-forum.com/.