spec/spec_helper.rb in logstash-input-unix-3.0.7 vs spec/spec_helper.rb in logstash-input-unix-3.1.0
- old
+ new
@@ -4,12 +4,13 @@
class UnixSocketHelper
attr_reader :path
- def initialize
+ def initialize(line = 'hi!')
@socket = nil
+ @line = line
end
def new_socket(path)
@path = path
File.unlink if File.exists?(path) && File.socket?(path)
@@ -19,12 +20,12 @@
def loop(forever=false)
@thread = Thread.new do
begin
s = @socket.accept
- s.puts "hi" while forever
- rescue Errno::EPIPE, Errno::ECONNRESET
- # ...
+ s.puts @line while forever
+ rescue Errno::EPIPE, Errno::ECONNRESET => e
+ warn e.inspect if $VERBOSE
end
end
self
end