るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.031秒)
トップページ > クエリ:IO[x] > クエリ:hash[x] > クエリ:out[x] > クエリ:pipeline_rw[x]

別のキーワード

  1. cgi out
  2. zstream avail_out
  3. zstream avail_out=
  4. zlib avail_out=
  5. zlib total_out

ライブラリ

モジュール

検索結果

Open3.#pipeline_rw(*cmds) {|first_stdin, last_stdout, wait_thrs| ... } -> () (18222.0)

指定したコマンドのリストをパイプで繋いで順番に実行します。最初の コマンドの標準入力に書き込む事も最後のコマンドの標準出力を受けとる事も できます。

...options には Hash で指定します。
env には環境変数を Hash で指定します。
cmdname にはコマンド名を表す String を指定します。
1、2、3 は shell 経由で実行されます。

(1) commandline
(2) [commandline, options]...
...たプロセスを待つため
のスレッドの配列を配列で返します。

例:

require "open3"

Open3.pipeline_rw("sort", "cat -n") {|stdin, stdout, wait_thrs|
stdin.puts "foo"
stdin.puts "bar"
stdin.puts "baz"

# sortコマンドにEOFを送る。
st...
...din.close

# stdinに渡した文字列をsortコマンドが並べ替えたものに、catコマンド
# が行番号を付けた文字列が表示される。
p stdout.read #=> " 1\tbar\n 2\tbaz\n 3\tfoo\n"
}

@see Open3.#popen3...