Skip to content
Browse files

use Thread.start for raedline instead EM.defer

  • Loading branch information...
1 parent 9c89c74 commit 8781bdda857f230ffccad6a49947e024bac5d84e @jugyo committed May 17, 2012
Showing with 13 additions and 17 deletions.
  1. +13 −17 lib/earthquake/core.rb
View
30 lib/earthquake/core.rb
@@ -125,24 +125,20 @@ def start(options = {})
restore_history
EM.run do
- EM.defer(
- lambda {
- while buf = Readline.readline(config[:prompt], true)
- unless Readline::HISTORY.count == 1
- Readline::HISTORY.pop if buf.empty? || Readline::HISTORY[-1] == Readline::HISTORY[-2]
- end
- sync {
- reload
- store_history
- input(buf.strip)
- }
+ Thread.start do
+ while buf = Readline.readline(config[:prompt], true)
+ unless Readline::HISTORY.count == 1
+ Readline::HISTORY.pop if buf.empty? || Readline::HISTORY[-1] == Readline::HISTORY[-2]
end
- },
- lambda { |_|
- # unexpected
- stop
- }
- )
+ sync {
+ reload
+ store_history
+ input(buf.strip)
+ }
+ end
+ # unexpected
+ stop
+ end
EM.add_periodic_timer(config[:output_interval]) do
next unless Readline.line_buffer.nil? || Readline.line_buffer.empty?

0 comments on commit 8781bdd

Please sign in to comment.
Something went wrong with that request. Please try again.