Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging rake tasks

I added debugger and require 'ruby-debug' in my task to debug it.

When I run my task from the console, it does hit the debugger, but doesn't let me inspect any variables. For example, if there's a line in my task :

my_var = 1 + 2

and I type my_var or my_var.inspect, while debugging, it says :

*** Unknown command: "my_var".  Try "help".

What am I missing ?

like image 806
Myxtic Avatar asked Nov 23 '25 07:11

Myxtic


1 Answers

Try to run

e my_var

If autoeval isn't set by default, you have to prefix any evaluation expression with e.

By the way, to set autoeval put the following line in ~/.rdebugrc:

set autoeval

After you do that, any command which is not recognized by the debugger will be considered as an attempt to evaluate en expression so you could just type the variable name to get its value.

like image 91
Erez Rabih Avatar answered Nov 24 '25 21:11

Erez Rabih