o:$YARD::CodeObjects::MethodObject:@scope:
class:@visibility:public:
@pathI"IO.pipe:EF:@parameters[�:@files[[I"	io.c;T0:@current_file_has_commentsF:
@name:	pipe:@source_type:c:
@tags[�:@docstringIC:YARD::Docstring"=IO.pipe(...) {|read_io, write_io| ... }

Creates a pair of pipe endpoints (connected to each other) and
returns them as a two-element array of <code>IO</code> objects:
<code>[</code> <i>read_io</i>, <i>write_io</i> <code>]</code>.

If a block is given, the block is called and
returns the value of the block.
<i>read_io</i> and <i>write_io</i> are sent to the block as arguments.
If read_io and write_io are not closed when the block exits, they are closed.
i.e. closing read_io and/or write_io doesn't cause an error.

Not available on all platforms.

If an encoding (encoding name or encoding object) is specified as an optional argument,
read string from pipe is tagged with the encoding specified.
If the argument is a colon separated two encoding names "A:B",
the read string is converted from encoding A (external encoding)
to encoding B (internal encoding), then tagged with B.
If two optional arguments are specified, those must be
encoding objects or encoding names,
and the first one is the external encoding,
and the second one is the internal encoding.
If the external encoding and the internal encoding is specified,
optional hash argument specify the conversion option.

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 <code>rd.read</code> will never return if it
does not first issue a <code>wr.close</code>.

   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

<em>produces:</em>

   Sending message to parent
   Parent got: <Hi Dad>;F:@objectIu:YARD::StubProxyIO.pipe;F:
@summary0:@ref_tags[�;[	o:YARD::Tags::OverloadTag
:@tag_nameI"
overload;F:
@text0;;:@types0:@signatureI"	pipe;F;IC;"�;F;Iu;IO.pipe;F;0;[�;[o:YARD::Tags::Tag
;I"return;F;I"�;F;0;[I"
Array;F;0:	@allI"@return [Array];F;[�;Iu;IO.pipe;Fo;
;I"
overload;F;0;;;0;I"pipe(ext_enc);F;IC;"�;F;Iu;IO.pipe;F;0;[�;[o;
;I"return;F;I"�;F;0;[I"
Array;F;0; I"@return [Array];F;[[:ext_enc0;Iu;IO.pipe;Fo;
;I"
overload;F;0;;;0;I"$pipe("ext_enc:int_enc" [, opt]);F;IC;"�;F;Iu;IO.pipe;F;0;[�;[o;
;I"return;F;I"�;F;0;[I"
Array;F;0; I"@return [Array];F;[[:"ext_enc:int_enc"[, opt]0;Iu;IO.pipe;Fo;
;I"
overload;F;0;;;0;I"#pipe(ext_enc, int_enc [, opt]);F;IC;"�;F;Iu;IO.pipe;F;0;[�;[o;
;I"return;F;I"�;F;0;[I"
Array;F;0; I"@return [Array];F;[[;!0[:int_enc[, opt]0;Iu;IO.pipe;F; I"   IO.pipe(...) {|read_io, write_io| ... }

Creates a pair of pipe endpoints (connected to each other) and
returns them as a two-element array of <code>IO</code> objects:
<code>[</code> <i>read_io</i>, <i>write_io</i> <code>]</code>.

If a block is given, the block is called and
returns the value of the block.
<i>read_io</i> and <i>write_io</i> are sent to the block as arguments.
If read_io and write_io are not closed when the block exits, they are closed.
i.e. closing read_io and/or write_io doesn't cause an error.

Not available on all platforms.

If an encoding (encoding name or encoding object) is specified as an optional argument,
read string from pipe is tagged with the encoding specified.
If the argument is a colon separated two encoding names "A:B",
the read string is converted from encoding A (external encoding)
to encoding B (internal encoding), then tagged with B.
If two optional arguments are specified, those must be
encoding objects or encoding names,
and the first one is the external encoding,
and the second one is the internal encoding.
If the external encoding and the internal encoding is specified,
optional hash argument specify the conversion option.

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 <code>rd.read</code> will never return if it
does not first issue a <code>wr.close</code>.

   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

<em>produces:</em>

   Sending message to parent
   Parent got: <Hi Dad>


@overload pipe
  @return [Array]
@overload pipe(ext_enc)
  @return [Array]
@overload pipe("ext_enc:int_enc" [, opt])
  @return [Array]
@overload pipe(ext_enc, int_enc [, opt])
  @return [Array];F:@namespaceIu;IO;F:@docstring_extra0:@sourceI"�
/*
 *  call-seq:
 *     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| ... }
 *
 *  Creates a pair of pipe endpoints (connected to each other) and
 *  returns them as a two-element array of <code>IO</code> objects:
 *  <code>[</code> <i>read_io</i>, <i>write_io</i> <code>]</code>.
 *
 *  If a block is given, the block is called and
 *  returns the value of the block.
 *  <i>read_io</i> and <i>write_io</i> are sent to the block as arguments.
 *  If read_io and write_io are not closed when the block exits, they are closed.
 *  i.e. closing read_io and/or write_io doesn't cause an error.
 *
 *  Not available on all platforms.
 *
 *  If an encoding (encoding name or encoding object) is specified as an optional argument,
 *  read string from pipe is tagged with the encoding specified.
 *  If the argument is a colon separated two encoding names "A:B",
 *  the read string is converted from encoding A (external encoding)
 *  to encoding B (internal encoding), then tagged with B.
 *  If two optional arguments are specified, those must be
 *  encoding objects or encoding names,
 *  and the first one is the external encoding,
 *  and the second one is the internal encoding.
 *  If the external encoding and the internal encoding is specified,
 *  optional hash argument specify the conversion option.
 *
 *  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 <code>rd.read</code> will never return if it
 *  does not first issue a <code>wr.close</code>.
 *
 *     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
 *
 *  <em>produces:</em>
 *
 *     Sending message to parent
 *     Parent got: <Hi Dad>
 */

static VALUE
rb_io_s_pipe(int argc, VALUE *argv, VALUE klass)
{
    int pipes[2], state;
    VALUE r, w, args[3], v1, v2;
    VALUE opt;
    rb_io_t *fptr, *fptr2;
    int fmode = 0;
    VALUE ret;

    opt = pop_last_hash(&argc, argv);
    rb_scan_args(argc, argv, "02", &v1, &v2);
    if (rb_pipe(pipes) == -1)
        rb_sys_fail(0);

    args[0] = klass;
    args[1] = INT2NUM(pipes[0]);
    args[2] = INT2FIX(O_RDONLY);
    r = rb_protect(io_new_instance, (VALUE)args, &state);
    if (state) {
    close(pipes[0]);
    close(pipes[1]);
    rb_jump_tag(state);
    }
    GetOpenFile(r, fptr);
    io_encoding_set(fptr, v1, v2, opt);
    args[1] = INT2NUM(pipes[1]);
    args[2] = INT2FIX(O_WRONLY);
    w = rb_protect(io_new_instance, (VALUE)args, &state);
    if (state) {
    close(pipes[1]);
    if (!NIL_P(r)) rb_io_close(r);
    rb_jump_tag(state);
    }
    GetOpenFile(w, fptr2);
    rb_io_synchronized(fptr2);

    extract_binmode(opt, &fmode);
    fptr->mode |= fmode;
    fptr2->mode |= fmode;

    ret = rb_assoc_new(r, w);
    if (rb_block_given_p()) {
    VALUE rw[2];
    rw[0] = r;
    rw[1] = w;
    return rb_ensure(rb_yield, ret, pipe_pair_close, (VALUE)rw);
    }
    return ret;
};F