0

can somebody explain why the following code won't spawn the passed block ?

require 'daemons'

t = Daemons.call do
  # This block does not start
  File.open('out.log','w') do    # code don't get here to open a file
    |fw|
    10.times {
      fw.puts "=>#{rand(100)}"
      sleep 1
    }
  end
end
#t.start # has no effect
10.times {
  puts "Running ? #{t.running?}"    # prints "Running ? false" 10 times
  sleep 1
}
t.stop
puts 'finished'

Ruby 1.9.3p392, x86_64 Linux

4

1 に答える 1