るりまサーチ

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

別のキーワード

  1. open3 pipeline_r
  2. open3 pipeline_rw
  3. open3 pipeline_w
  4. open3 pipeline_start
  5. open3 pipeline

ライブラリ

モジュール

検索結果

Open3.#pipeline_r(*cmds) {|last_stdout, wait_thrs| ... } -> () (18208.0)

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

...ndline, options]
(3) [env, commandline, options]
(4) [env, cmdname, arg1, arg2, ..., options]
(5) [env, [cmdname, argv0], arg1, ..., options]

@return ブロックを指定した場合はブロックの最後に評価された値を返します。
ブロックを指定しなかった場...
...列で返します。

例:

require "open3"

Open3.pipeline_r("yes", "head -10") {|r, ts|
p r.read #=> "y\ny\ny\ny\ny\ny\ny\ny\ny\ny\n"
p ts[0].value #=> #<Process::Status: pid 24910 SIGPIPE (signal 13)>
p ts[1].value #=> #<Process::Status: pid 24913 exit 0>
}

@see Open3.#...

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

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

...ndline, options]
(3) [env, commandline, options]
(4) [env, cmdname, arg1, arg2, ..., options]
(5) [env, [cmdname, argv0], arg1, ..., options]

@return ブロックを指定した場合はブロックの最後に評価された値を返します。
ブロックを指定しなかった場...
...つため
のスレッドの配列を配列で返します。

例:

require "open3"

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

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

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

@see Open3.#popen3...