1
2
3
4
5
6
7
8
9
#!/usr/bin/env ruby -wKU

trap('SIGINT')  { STDERR << "#{Time.now} ← receive\n" }
fork            { sleep 0.5; STDERR << "#{Time.now} ← send\n"; Process.kill('SIGINT', Process.ppid) }

%x{true}

pid = fork { exec('sleep', '4') }
Process.wait(pid)