lib/pitchfork/worker.rb in pitchfork-0.6.0 vs lib/pitchfork/worker.rb in pitchfork-0.7.0
- old
+ new
@@ -196,24 +196,27 @@
@master.close if @master
@to_io.close if @to_io
end
def create_socketpair!
- @to_io, @master = Pitchfork.socketpair
+ @to_io, @master = Info.keep_ios(Pitchfork.socketpair)
end
def after_fork_in_child
@master&.close
end
private
def pipe=(socket)
+ raise ArgumentError, "pipe can't be nil" unless socket
+ Info.keep_io(socket)
@master = MessageSocket.new(socket)
end
def send_message_nonblock(message)
success = false
+ return false unless @master
begin
case @master.sendmsg_nonblock(message, exception: false)
when :wait_writable
else
success = true