jugyo / termtter

moved to https://github.com/termtter/termtter
201 stars 34 forks source link

http_serverを読んだtermtterがrubyのtrunkで動作しない #119

Open sorah opened 14 years ago

sorah commented 14 years ago

ruby -v: ruby 1.9.3dev (2010-05-08 trunk 27661) [x86_64-darwin10.3.0]

http_serverを読み込む設定のtermtterを起動しようとすると

[ERROR] SystemStackError: stack level too deep

になって起動後プロンプトもあらわれず停止します。^Cに応答しても異常終了に見えます。

[DEBUG] output: call hook :output #<Termtter::Hook:0x0000010137ee28 @name=:http_server_output, @points=[:output], @exec_proc=#<Proc:0x0000010137ee78@/Users/sorah/git/ruby/termtter/lib/plugins/http_server.rb:23>>
[DEBUG] rubytter_proxy: list_statuses("sora_h", "friends")
[ERROR] SystemStackError: stack level too deep
/Users/sorah/git/ruby/termtter/lib/termtter/client.rb:340:in `handle_error': undefined method `join' for "/Users/sorah/git/ruby/termtter/lib/plugins/http_server.rb:24":String (NoMethodError)
        from /Users/sorah/git/ruby/termtter/lib/plugins/defaults/auto_reload.rb:8:in `rescue in block in <top (required)>'
        from /Users/sorah/git/ruby/termtter/lib/plugins/defaults/auto_reload.rb:3:in `block in <top (required)>'
        from /Users/sorah/git/ruby/termtter/lib/termtter/hook.rb:29:in `call'
        from /Users/sorah/git/ruby/termtter/lib/termtter/hook.rb:29:in `call'
        from /Users/sorah/git/ruby/termtter/lib/termtter/hookable.rb:55:in `block in call_hooks'
        from /Users/sorah/git/ruby/termtter/lib/termtter/hookable.rb:52:in `each'
        from /Users/sorah/git/ruby/termtter/lib/termtter/hookable.rb:52:in `call_hooks'
        from /Users/sorah/git/ruby/termtter/lib/termtter/client.rb:330:in `run'
        from /Users/sorah/git/ruby/termtter/bin/termtter:15:in `<main>'
emasaka commented 14 years ago

問題が2つあって:

  1. (たぶん)http_serverプラグインで例外が発生する
  2. その例外の処理が無限呼び出しになる

このうち2について、上のログではException#backtraceの値が "/Users/sorah/git/ruby/termtter/lib/plugins/http_server.rb:24" というStringになっているのが奇怪です。その結果、NoMethodErrorになる、と。再定義されていなければ、RubyのコアでArrayに強制しているはずなのですが。

irb(main):001:0> e = Exception.new
=> #<Exception: Exception>
irb(main):002:0> e.set_backtrace("hoge")
=> ["hoge"]
irb(main):003:0> e.backtrace
=> ["hoge"]