有没有办法摆脱“挂"?在 IRB 状态? [英] Is there a way to get out of a "hung" state in IRB?

查看:40
本文介绍了有没有办法摆脱“挂"?在 IRB 状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 irbrails 控制台 时,我有时会卡住.例如,我忘记了结束语,所以当我按下 Enter 键时,它仍在等待.

When using irb or rails console, I sometimes get stuck. For example, I forget a closing quote, so when I press enter, it's still waiting on that.

有时我可以摆脱这种情况(例如,通过提供结束语),但有时我不能.如果没有,我通常会执行以下操作:

Sometimes I can get out of this (by suppyling the closing quote, for example), but sometimes I can't. If not, I usually do the following:

# Suspend the irb or console process
(Control + Z)

# Kill the last suspended process
kill -9 %

这很烦人,会干扰我在控制台中所做的一切.我想要的是相当于命令行上的 Control + C ,说忘记那个 - 给我一个新提示",这样我就可以继续在控制台中工作.

This is annoying and disrupts whatever I was doing in the console. What I'd like is an equivalent to Control + C on the command line, to say "forget that - give me a new prompt", so I can continue working in the console.

有没有办法做到这一点?

Is there a way to do this?

推荐答案

Control + D 一次或两次.应该这样做.

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

这篇关于有没有办法摆脱“挂"?在 IRB 状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆