rendered paste bodydiff -rN -u old-ruby-wmii/wmiirc new-ruby-wmii/wmiirc
--- old-ruby-wmii/wmiirc 2006-06-22 13:08:28.000000000 +0200
+++ new-ruby-wmii/wmiirc 2006-06-22 13:08:28.000000000 +0200
@@ -450,11 +450,12 @@
system("wmiir -a #{@address} create #{file}")
end
- def foreach(file)
- open("|wmiir read /event") do |is|
+ def foreach(file, &block)
+ open("|wmiir read #{file}") do |is|
+ LOGGER.debug "Executing foreach, using process #{is.pid}"
$children << is.pid
is.fcntl Fcntl::F_SETFD, Fcntl::FD_CLOEXEC
- loop { yield is.gets }
+ is.each(&block)
end
nil
end
@@ -614,9 +615,10 @@
loop do
begin
# wait for events
+ LOGGER.debug "Opening /event"
@ixp_conn.foreach("/event") do |line|
begin
- LOGGER.debug "Got #{line.inspect}"
+ LOGGER.debug "Got #{line.inspect}" if line
case line
when /^(BarClick|ClientClick)\s+(\S+)\s+(\S+)$/
@procs[$1].each{|x| x.call($2, $3.to_i)}