lib/tork/server.rb in tork-18.2.2 vs lib/tork/server.rb in tork-18.2.3
- old
+ new
@@ -14,21 +14,19 @@
def loop
@client = Client::Transmitter.new(STDOUT.dup)
STDOUT.reopen(STDERR).sync = true
Client::Receiver.new(STDIN) do |command|
- method = command.first
- if respond_to? method and method != __method__ # prevent loops
+ if command.first != __method__ # prevent loops
@command = command
- __send__(*command)
- else
- warn "#{self}: invalid command: #{method}"
+ begin
+ __send__(*command)
+ rescue => error
+ warn "#{$0}: #{error}"
+ warn error.backtrace.join("\n")
+ end
end
end.join
- rescue Interrupt
- # forced quit
- ensure
- Process.waitall
end
end
end