--- !ruby/object:RI::MethodDescription
aliases: []
block_params:
comment:
- !ruby/struct:SM::Flow::P
body: "Creates a pair of pipe endpoints (connected to each other) and returns them as a two-element array of IO objects: [ read_file, write_file ]. Not available on all platforms."
- !ruby/struct:SM::Flow::P
body: In the example below, the two processes close the ends of the pipe that they are not using. This is not just a cosmetic nicety. The read end of a pipe will not generate an end of file condition if there are any writers with the pipe still open. In the case of the parent process, the rd.read will never return if it does not first issue a wr.close.
- !ruby/struct:SM::Flow::VERB
body: " rd, wr = IO.pipe\n\n if fork\n wr.close\n puts "Parent got: <#{rd.read}>"\n rd.close\n Process.wait\n else\n rd.close\n puts "Sending message to parent"\n wr.write "Hi Dad"\n wr.close\n end\n"
- !ruby/struct:SM::Flow::P
body: produces:
- !ruby/struct:SM::Flow::VERB
body: " Sending message to parent\n Parent got: <Hi Dad>\n"
full_name: IO::pipe
is_singleton: true
name: pipe
params: |
IO.pipe -> array
visibility: public