Class: Pwrake::HandlerSet

Inherits:
Array
  • Object
show all
Defined in:
lib/pwrake/iomux/handler_set.rb

Instance Method Summary collapse

Instance Method Details

#exitObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/pwrake/iomux/handler_set.rb', line 12

def exit
  a = []
  each do |hdl|
    iow = hdl.iow
    begin
      iow.puts "exit"
      iow.flush
      a << hdl
      Log.debug "HandlerSet#exit iow=#{iow.inspect}"
    rescue Errno::EPIPE => e
      if Rake.application.options.debug
        $stderr.puts "Errno::EPIPE in #{self.class}.exit iow=#{iow.inspect}"
        $stderr.puts e.backtrace.join("\n")
      end
      Log.error "Errno::EPIPE in #{self.class}.exit iow=#{iow.inspect}\n"+
        e.backtrace.join("\n")
    end
  end
  a.each{|hdl| hdl.wait_message("exited")}
  Log.debug "HandlerSet#exit end"
end

#kill(sig) ⇒ Object



5
6
7
8
9
10
# File 'lib/pwrake/iomux/handler_set.rb', line 5

def kill(sig)
  each do |hdl|
    hdl.iow.puts("kill:#{sig}")
    hdl.iow.flush
  end
end