From: Joseph McDonald Date: 2001-06-30T12:50:30+09:00 Subject: [ruby-talk:17091] ensure block not being executed Hi, Am I missing something here? I run this program and kill it with ^C but then the ensure block doesn't get called. I thought ensure was supposed to be called no matter what. Am I wrong on this? Here is the code and the output: cat junker.rb #!/usr/local/bin/ruby require 'sysvipc' include SystemVIPC begin key = ftok __FILE__, 1 msq = MessageQueue.new key, 0700 | IPC_CREAT # enqueue messages 0.upto(10) do |x| msq.send 100, x.to_s end # dequeue messages while (s = msq.recv 100, 100) puts "got: #{s}" end # remove the queue ensure puts "ensure block" msq.remove end ./junker.rb got: 0 got: 1 got: 2 got: 3 got: 4 got: 5 got: 6 got: 7 got: 8 got: 9 got: 10 ^C./junker.rb:23: Interrupt thanks, -joe