るりまサーチ

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

別のキーワード

  1. _builtin hash
  2. hash []
  3. matrix hash
  4. dbm to_hash
  5. _builtin to_hash

ライブラリ

検索結果

Open3.#pipeline_rw(*cmds) -> [IO, IO, [Thread]] (31.0)

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

...コマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環境変数を Hash で指定します。
cmdname にはコマンド名を表す String を指定します。
1...
...ます。

例:

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...

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

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

...コマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環境変数を Hash で指定します。
cmdname にはコマンド名を表す String を指定します。
1...
...ます。

例:

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...