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

When using irb or rails console I sometimes get stuck. For example, I forget the final quote, so when I press the enter button, it is still waiting for it.

Sometimes I can get out of this (for example, by adding a final quote), but sometimes I cannot. If not, I usually do the following:

 # Suspend the irb or console process (Control + Z) # Kill the last suspended process kill -9 % 

This annoys and upsets everything I did in the console. What I need is equivalent to Control + C on the command line to say "forget that - give me a new prompt," so I can continue to work in the console.

Is there any way to do this?

+6
source share
1 answer

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

+17
source

Source: https://habr.com/ru/post/902937/


All Articles