I'm pretty sure we have found a bug in Ruby while working on TextMate.
This simple script shows the issue with recent versions of Ruby on at east Mac OS X and FreeBSD:
#!/usr/bin/env ruby -wKU
trap('SIGINT') { warn "#{Time.now} receive" }
fork { sleep 0.5
warn "#{Time.now} вл send"
Process.kill('SIGINT', Process.ppid) }
%x{true} # comment out this line to eliminate the pause
pid = fork { exec('sleep', '4') }
Process.wait(pid)
When this script is run we see a four second delay between the two
times. However, you can comment out the %w{true} line and the script
then behaves as expected (no delay).
Using SIGUSR1 instead of SIGINT also resolves the issue.
The script did work correctly on CentOS with Ruby 1.8.1, so either
the change of OS helped or it's a newer bug.
James Edward Gray II