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?
On Aug 30, 2006, at 11:49 PM, Tom A. 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 ?
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 Aug 31, 2006, at 2:11 PM, Tom A. wrote:
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 ?
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
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
hi,
what does this output:
require ‘rbconfig’
puts “topdir #{RbConfig::CONFIG[‘topdir’]}”
puts “RUBY_DESCRIPTION: #{RUBY_DESCRIPTION}”
in both the cases,
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs