How to Get Out of a "Hung" State in Irb

Is there a way to get out of a hung state in IRB?

Press Control + D once or twice. That should do it.

How to get unstuck in Ruby irb?

You can press ctrl + c followed by return to get back IRB's prompt.

Command line / IRB won't return values - Ruby

This occurs when you have entered an incomplete expression that requires closing characters of some kind to complete it. Example:

Incomplete expression in IRB

The ? in the prompt indicates that the REPL is waiting on closing characters to evaluate the expression.

You can exit this state by completing the expression or by aborting its evaluation with Ctrl+c.

How do I step out of a loop with Ruby Pry?

To exit Pry unconditionally, type

exit-program

Edit from @Nick's comment: Also works:

!!!

Rails console (END) how to get past it?

stumbled over this problem, after some tries I found the solution :)

shift + Q

Edit: as mentioned by @Paul, only Q will suffice.

Ruby on Rails console is hanging when loading

Restarting Spring should fix the hanging commands:

$ bin/spring stop

I experienced hanging commands (rake, bin/rails, etc.) after deleting and recreating a new Ruby on Rails application. Google wasn't that helpful. I hope this is.

Spring will start automatically when you re-run your command.

Can't stop rails server

You can use other ports like the following:

rails server -p 3001

Normally in your terminal you can try Ctrl + C to shutdown the server.

The other way to kill the Ruby on Rails default server (which is WEBrick) is:

kill -INT $(cat tmp/pids/server.pid)

In your terminal to find out the PID of the process:

$ lsof -wni tcp:3000

Then, use the number in the PID column to kill the process:

For example:

$ kill -9 PID

And some of the other answers i found is:

To stop the rails server while it's running, press:

CTRL-C
CTRL-Z

You will get control back to bash. Then type (without the $):

$ fg

And this will go back into the process, and then quit out of Rails s properly.

It's a little annoying, but this sure beats killing the process manually. It's not too bad and it's the best I could figure out.

Updated answer:

You can use killall -9 rails to kill all running apps with "rails" in the name.

killall -9 rails

How do I clear stuck/stale Resque workers?

None of these solutions worked for me, I would still see this in redis-web:

0 out of 10 Workers Working

Finally, this worked for me to clear all the workers:

Resque.workers.each {|w| w.unregister_worker}


Related Topics



Leave a reply



Submit