るりまサーチ

最速Rubyリファレンスマニュアル検索!
231件ヒット [101-200件を表示] (0.071秒)
トップページ > クエリ:-[x] > クエリ:popen3[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

モジュール

キーワード

検索結果

<< < 1 2 3 > >>

Open3.#capture2e(*cmd) -> [String, Process::Status] (118.0)

cmdで指定されたコマンドを実行し、そのプロセスの標準出力と標準エラーを1 つの文字列にしたものとプロセスの終了ステータスを表すオブジェクトを返し ます。

...ータスを表すオブジェクトを配列で返します。

指定された引数はopts[:stdin_data]とopts[:binmode]以外は全て
Open3.#popen3に渡されます。opts[:stdin_data]は実行するコマンドの
標準入力に渡されます。opts[:binmode]を真に指定されると内...
...= Open3.capture2e("echo a; sort >&2", :stdin_data=>"foo\nbar\nbaz\n")
p o #=> "a\nbar\nbaz\nfoo\n"
p s #=> #<Process::Status: pid 20574 exit 0>

Open3.#popen3と同様に引数に環境変数とオプションを指定してコマンド
を実行する事ができます。

@see Open3.#popen3...

Open3.#capture3(*cmd) -> [String, String, Process::Status] (118.0)

cmdで指定されたコマンドを実行し、そのプロセスの標準出力と標準エラー、プ ロセスの終了ステータスを表すオブジェクトを返します。

...スを表すオブジェクトを配列で返します。

指定された引数はopts[:stdin_data]とopts[:binmode]以外は全て
Open3.#popen3に渡されます。opts[:stdin_data]は実行するコマンドの
標準入力に渡されます。opts[:binmode]を真に指定されると内...
...ture3("echo a; sort >&2", :stdin_data=>"foo\nbar\nbaz\n")
p o #=> "a\n"
p e #=> "bar\nbaz\nfoo\n"
p s #=> #<Process::Status: pid 32682 exit 0>

Open3.#popen3と同様に引数に環境変数とオプションを指定してコマンド
を実行する事ができます。

@see Open3.#popen3...

Open3.#pipeline(*cmds) -> [Process::Status] (118.0)

指定したコマンドのリストをパイプで繋いで順番に実行します。

...のコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環境変数を H...
...ンドの終了ステータスを配列で返します。

例1:

require "open3"

fname = "/usr/share/man/man1/ruby.1.gz"
p Open3
.pipeline(["zcat", fname], "nroff -man", "less")
#=> [#<Process::Status: pid 11817 exit 0>,
# #<Process::Status: pid 11820 exit 0>,
# #<Process::Statu...
...s: pid 11828 exit 0>]

例2:

require "open3"

Open3.pipeline([{"LANG"=>"C"}, "env"], ["grep", "LANG"], "less")

@see Open3.#popen3...

Open3.#pipeline_r(*cmds) -> [IO, [Thread]] (118.0)

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

...のコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環境変数を H...
...します。

例:

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

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

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

...のコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環境変数を H...
...します。

例:

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

絞り込み条件を変える

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

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

...のコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環境変数を H...
...プロセスを待つため
のスレッドの配列を配列で返します。

例:

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| ... } -> () (118.0)

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

...のコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環境変数を H...
...プロセスを待つため
のスレッドの配列を配列で返します。

例:

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_w(*cmds) -> [IO, [Thread]] (118.0)

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

...のコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環境変数を H...
...た場合は最初に実行するコマンドの標準入力、
実行したプロセスを待つためのスレッドの配列を配列で返します。

例:

require "open3"

Open3.pipeline_w("bzip2 -c", :out=>"/tmp/hello.bz2") {|w, ts|
w.puts "hello"
}

@see Open3.#popen3...

Open3.#pipeline_w(*cmds) {|first_stdin, wait_thrs| ... } -> () (118.0)

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

...のコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環境変数を H...
...た場合は最初に実行するコマンドの標準入力、
実行したプロセスを待つためのスレッドの配列を配列で返します。

例:

require "open3"

Open3.pipeline_w("bzip2 -c", :out=>"/tmp/hello.bz2") {|w, ts|
w.puts "hello"
}

@see Open3.#popen3...

Open3.#pipeline_start(*cmds) -> [Thread] (112.0)

指定したコマンドのリストをパイプで繋いで順番に実行します。

...のコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環境変数を H...
...
ドの配列を返します。

例:

require "open3"

# xeyesを10秒だけ実行する。
Open3.pipeline_start("xeyes") {|ts|
sleep 10
t = ts[0]
Process.kill("TERM", t.pid)
p t.value #=> #<Process::Status: pid 911 SIGTERM (signal 15)>
}

@see Open3.#popen3...

絞り込み条件を変える

<< < 1 2 3 > >>