문제

Is there a way to have a ruby script echo back (or log to file I can tail -f) every line executed, similar to bash -x or @echo on in DOS?

ruby -w doesn't do it--only increases verbosity of warnings etc.

Researched Unroller but it doesn't work, possibly too dated. Uncompilable dependencies.

I use irb a lot but in this case I need something non-interactive eg. to inspect post-mortem.

도움이 되었습니까?

해결책

You can use

ruby -rtracer [your_script.rb]

There is also ruby-debug which can do

rdebug --trace [your_script.rb]

다른 팁

IRB does the trick:

irb script.rb
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top