抛出错误后,Rails控制台会修改终端中的键盘输入

时间:2015-01-17 03:09:36

标签: ruby-on-rails terminal

我有点奇怪的问题。

每当我打开rails控制台时,它似乎都能正常工作,直到发生错误。然后ruby过程不会停止,即使是cmd-c& cmd-z,键盘被接管

例如,输入fhfh后我得到了这个

irb(main):003:0> fhfh
NameError: undefined local variable or method `fhfh' for main:Object
    from (irb):3
    from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.8/lib/rails/commands/console.rb:90:in `start'
    from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.8/lib/rails/commands/console.rb:9:in `start'
    from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:69:in `console'
    from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'
    from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
    from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `block in require'
    from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
    from /Users/tristangrace/Dropbox/repos/memoryzen/memoryzen/bin/rails:8:in `<top (required)>'
    from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `load'
    from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `block in load'
    from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `load'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/commands/rails.rb:6:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/command_wrapper.rb:38:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/application.rb:183:in `block in serve'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/application.rb:156:in `fork'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/application.rb:156:in `serve'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/application.rb:131:in `block in run'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/application.rb:125:in `loop'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/application.rb:125:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1^C

然后在终端中输入任何内容都会被修改。 例如,按住左箭头返回DD[D[D[D[D[[DDD

我甚至无法回到使用终端。我必须开一个新的。当我试图关闭窗口时,它表示红宝石过程仍在运行,我必须强制关闭它。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

看起来你正在使用OS X;您使用的终端程序是什么?

如果它是内置的,请转到“首选项”,然后选择“个人档案”,选择您使用的那个,单击“高级”,并确保terminfo为xterm-256color,并且您不要使用Control-V&#34;&#34;转义非ASCII输入地选择。

我还要确保&#34;在启动时设置语言环境变量&#34;被选中。