U:RDoc::AnyMethod[iI" pipe:ETI" IO::pipe;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"DCreates a pair of pipe endpoints (connected to each other) and ;TI"Ereturns them as a two-element array of IO objects: ;TI"C[ read_io, write_io ].;To:RDoc::Markup::BlankLineo; ; [ I"2If a block is given, the block is called and ;TI"%returns the value of the block. ;TI"Lread_io and write_io are sent to the block as arguments. ;TI"SIf read_io and write_io are not closed when the block exits, they are closed. ;TI"Ai.e. closing read_io and/or write_io doesn't cause an error.;T@o; ; [I"$Not available on all platforms.;T@o; ; [I"]If an encoding (encoding name or encoding object) is specified as an optional argument, ;TI"Bread string from pipe is tagged with the encoding specified. ;TI"DIf the argument is a colon separated two encoding names "A:B", ;TI"Fthe read string is converted from encoding A (external encoding) ;TI"rd.read will never return if it ;TI"2does not first issue a wr.close.;T@o:RDoc::Markup::Verbatim; [I"rd, wr = IO.pipe ;TI" ;TI" if fork ;TI" wr.close ;TI"' puts "Parent got: <#{rd.read}>" ;TI" rd.close ;TI" Process.wait ;TI" else ;TI" rd.close ;TI"( puts "Sending message to parent" ;TI" wr.write "Hi Dad" ;TI" wr.close ;TI" end ;T: @format0o; ; [I"produces:;T@o; ; [I"Sending message to parent ;TI"Parent got: ;T; 0: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"IO.pipe -> [read_io, write_io] IO.pipe(ext_enc) -> [read_io, write_io] IO.pipe("ext_enc:int_enc" [, opt]) -> [read_io, write_io] IO.pipe(ext_enc, int_enc [, opt]) -> [read_io, write_io] IO.pipe(...) {|read_io, write_io| ... } ;T0[I" (p1 = v1, p2 = v2, p3 = {});T@FFI"IO;TcRDoc::NormalClass00