File: //usr/share/ri/3.0.0/system/Open3/pipeline_rw-i.ri
U:RDoc::AnyMethod[iI"pipeline_rw:ETI"Open3#pipeline_rw;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"JOpen3.pipeline_rw starts a list of commands as a pipeline with pipes ;TI"Pwhich connect to stdin of the first command and stdout of the last command.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [
I"[Open3.pipeline_rw(cmd1, cmd2, ... [, opts]) {|first_stdin, last_stdout, wait_threads|
;TI" ...
;TI"}
;TI"
;TI"Zfirst_stdin, last_stdout, wait_threads = Open3.pipeline_rw(cmd1, cmd2, ... [, opts])
;TI" ...
;TI"first_stdin.close
;TI"last_stdout.close
;T:@format0o;
; [I"'Each cmd is a string or an array. ;TI"AIf it is an array, the elements are passed to Process.spawn.;T@o;; [I"
cmd:
;TI"_ commandline command line string which is passed to a shell
;TI"_ [env, commandline, opts] command line string which is passed to a shell
;TI"b [env, cmdname, arg1, ..., opts] command name and one or more arguments (no shell)
;TI"h [env, [cmdname, argv0], arg1, ..., opts] command name and arguments including argv[0] (no shell)
;TI"
;TI"@Note that env and opts are optional, as for Process.spawn.
;T;
0o;
; [I"EThe options to pass to Process.spawn are constructed by merging ;TI"5+opts+, the last hash element of the array, and ;TI"?specifications for the pipes between each of the commands.;T@o;
; [I"
Example:;T@o;; [I"=Open3.pipeline_rw("tr -dc A-Za-z", "wc -c") {|i, o, ts|
;TI"F i.puts "All persons more than a mile high to leave the court."
;TI" i.close
;TI" p o.gets #=> "42\n"
;TI"}
;TI"
;TI"EOpen3.pipeline_rw("sort", "cat -n") {|stdin, stdout, wait_thrs|
;TI" stdin.puts "foo"
;TI" stdin.puts "bar"
;TI" stdin.puts "baz"
;TI"+ stdin.close # send EOF to sort.
;TI"E p stdout.read #=> " 1\tbar\n 2\tbaz\n 3\tfoo\n"
;TI"};T;
0:
@fileI"lib/open3.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(*cmds, &block);T@>FI"
Open3;TcRDoc::NormalModule00