Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- r, w = IO.pipe
- pid0 = fork {
- r.close
- pid1 = fork {
- sleep 2
- puts 'bah!'
- }
- w.puts pid1
- w.close
- }
- w.close
- Process.waitpid(pid0)
- pid1 = r.gets.to_i
- r.close
- #sleep 2
- at_exit { Process.kill 'HUP', pid1 }
Add Comment
Please, Sign In to add comment