Created
October 7, 2009 07:50
-
-
Save tansengming/203858 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rd, wr = IO.pipe | |
if fork | |
wr.close | |
puts "Parent got: <#{rd.read}>" | |
rd.close | |
Process.wait | |
else | |
rd.close | |
puts "Sending message to parent" | |
wr.write "Hi Dad" | |
wr.close | |
end | |
# Produces | |
# Sending message to parent | |
# Parent got: <Hi Dad> | |
# From: http://www.ruby-doc.org/docs/rdoc/1.9/classes/IO.html#M001074 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment