別のキーワード
ライブラリ
- open3 (216)
キーワード
- capture2 (12)
- capture2e (12)
- capture3 (12)
- pipeline (12)
-
pipeline
_ r (24) -
pipeline
_ rw (24) -
pipeline
_ start (24) -
pipeline
_ w (24) - popen2 (24)
- popen2e (24)
- popen3 (24)
検索結果
先頭5件
-
Open3
. # popen3(*cmd) -> [IO , IO , IO , Thread] (9126.0) -
外部プログラム cmd を実行し、そのプロセスの標準入力、標準出力、標準エラー 出力に接続されたパイプと実行したプロセスを待つためのスレッドを 4 要素の 配列で返します。
...実行したプロセスを待つためのスレッドを 4 要素の
配列で返します。
require 'open3'
stdin, stdout, stderr, wait_thr = *Open3.popen3("/usr/bin/nroff -man")
@param cmd 実行するコマンドを指定します。
@return ブロックを指定した場合はブロッ......最後の式の結果を返します。
require 'open3'
Open3.popen3("read stdin; echo stdout; echo stderr >&2") {|stdin, stdout, stderr, wait_thr|
stdin.puts "stdin"
stdin.close # または close_write
p stdout.read
p stderr.read
}
#=> "stdout\n"
"stderr\n"
std......lose_write
で閉じるべきです。
[UNIX系OS固有の注意] Open3 で作成した子プロセスは
wait(2) しなくてもゾンビになりません。
引数 cmd はそのまま Kernel.#spawn に渡されます。
Kernel.#spawnと同様に、引数リストの最初に環境変数をハ... -
Open3
. # popen3(*cmd) {|stdin , stdout , stderr , wait _ thr| . . . } -> () (9126.0) -
外部プログラム cmd を実行し、そのプロセスの標準入力、標準出力、標準エラー 出力に接続されたパイプと実行したプロセスを待つためのスレッドを 4 要素の 配列で返します。
...実行したプロセスを待つためのスレッドを 4 要素の
配列で返します。
require 'open3'
stdin, stdout, stderr, wait_thr = *Open3.popen3("/usr/bin/nroff -man")
@param cmd 実行するコマンドを指定します。
@return ブロックを指定した場合はブロッ......最後の式の結果を返します。
require 'open3'
Open3.popen3("read stdin; echo stdout; echo stderr >&2") {|stdin, stdout, stderr, wait_thr|
stdin.puts "stdin"
stdin.close # または close_write
p stdout.read
p stderr.read
}
#=> "stdout\n"
"stderr\n"
std......lose_write
で閉じるべきです。
[UNIX系OS固有の注意] Open3 で作成した子プロセスは
wait(2) しなくてもゾンビになりません。
引数 cmd はそのまま Kernel.#spawn に渡されます。
Kernel.#spawnと同様に、引数リストの最初に環境変数をハ... -
Open3
. # pipeline _ r(*cmds) -> [IO , [Thread]] (9120.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。最後の コマンドの標準出力を受けとる事ができます。
...マンドのリストをパイプで繋いで順番に実行します。最後の
コマンドの標準出力を受けとる事ができます。
@param cmds 実行するコマンドのリストを指定します。それぞれのコマンドは
以下のように String か Array で......options には Hash で指定します。
env には環境変数を Hash で指定します。
cmdname にはコマンド名を表す String を指定します。
1、2、3 は shell 経由で実行されます。
(1) commandline
(2) [commandline, options]......(3) [env, commandline, options]
(4) [env, cmdname, arg1, arg2, ..., options]
(5) [env, [cmdname, argv0], arg1, ..., options]
@return ブロックを指定した場合はブロックの最後に評価された値を返します。
ブロックを指定しなかった場合は最後に実... -
Open3
. # pipeline _ r(*cmds) {|last _ stdout , wait _ thrs| . . . } -> () (9120.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。最後の コマンドの標準出力を受けとる事ができます。
...マンドのリストをパイプで繋いで順番に実行します。最後の
コマンドの標準出力を受けとる事ができます。
@param cmds 実行するコマンドのリストを指定します。それぞれのコマンドは
以下のように String か Array で......options には Hash で指定します。
env には環境変数を Hash で指定します。
cmdname にはコマンド名を表す String を指定します。
1、2、3 は shell 経由で実行されます。
(1) commandline
(2) [commandline, options]......(3) [env, commandline, options]
(4) [env, cmdname, arg1, arg2, ..., options]
(5) [env, [cmdname, argv0], arg1, ..., options]
@return ブロックを指定した場合はブロックの最後に評価された値を返します。
ブロックを指定しなかった場合は最後に実... -
Open3
. # pipeline(*cmds) -> [Process :: Status] (9108.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。
...指定したコマンドのリストをパイプで繋いで順番に実行します。
@param cmds 実行するコマンドのリストを指定します。それぞれのコマンドは
以下のように String か Array で指定します。
commandline にはコマン......options には Hash で指定します。
env には環境変数を Hash で指定します。
cmdname にはコマンド名を表す String を指定します。
1、2、3 は shell 経由で実行されます。
(1) commandline
(2) [commandline, options]......commandline, options]
(4) [env, cmdname, arg1, arg2, ..., options]
(5) [env, [cmdname, argv0], arg1, ..., options]
@return 実行したコマンドの終了ステータスを配列で返します。
例1:
require "open3"
fname = "/usr/share/man/man1/ruby.1.gz"
p Open3.pipeline(["zcat",... -
Open3
. # pipeline _ rw(*cmds) -> [IO , IO , [Thread]] (9108.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。最初の コマンドの標準入力に書き込む事も最後のコマンドの標準出力を受けとる事も できます。
...行します。最初の
コマンドの標準入力に書き込む事も最後のコマンドの標準出力を受けとる事も
できます。
@param cmds 実行するコマンドのリストを指定します。それぞれのコマンドは
以下のように String か Array で......options には Hash で指定します。
env には環境変数を Hash で指定します。
cmdname にはコマンド名を表す String を指定します。
1、2、3 は shell 経由で実行されます。
(1) commandline
(2) [commandline, options]......(3) [env, commandline, options]
(4) [env, cmdname, arg1, arg2, ..., options]
(5) [env, [cmdname, argv0], arg1, ..., options]
@return ブロックを指定した場合はブロックの最後に評価された値を返します。
ブロックを指定しなかった場合は最初に実... -
Open3
. # pipeline _ rw(*cmds) {|first _ stdin , last _ stdout , wait _ thrs| . . . } -> () (9108.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。最初の コマンドの標準入力に書き込む事も最後のコマンドの標準出力を受けとる事も できます。
...行します。最初の
コマンドの標準入力に書き込む事も最後のコマンドの標準出力を受けとる事も
できます。
@param cmds 実行するコマンドのリストを指定します。それぞれのコマンドは
以下のように String か Array で......options には Hash で指定します。
env には環境変数を Hash で指定します。
cmdname にはコマンド名を表す String を指定します。
1、2、3 は shell 経由で実行されます。
(1) commandline
(2) [commandline, options]......(3) [env, commandline, options]
(4) [env, cmdname, arg1, arg2, ..., options]
(5) [env, [cmdname, argv0], arg1, ..., options]
@return ブロックを指定した場合はブロックの最後に評価された値を返します。
ブロックを指定しなかった場合は最初に実... -
Open3
. # pipeline _ start(*cmds) -> [Thread] (9108.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。
...指定したコマンドのリストをパイプで繋いで順番に実行します。
@param cmds 実行するコマンドのリストを指定します。それぞれのコマンドは
以下のように String か Array で指定します。
commandline にはコマン......options には Hash で指定します。
env には環境変数を Hash で指定します。
cmdname にはコマンド名を表す String を指定します。
1、2、3 は shell 経由で実行されます。
(1) commandline
(2) [commandline, options]......(3) [env, commandline, options]
(4) [env, cmdname, arg1, arg2, ..., options]
(5) [env, [cmdname, argv0], arg1, ..., options]
@return ブロックを指定した場合はブロックの最後に評価された値を返します。
ブロックを指定しなかった場合は実行した... -
Open3
. # pipeline _ start(*cmds) {|wait _ thrs| . . . } -> () (9108.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。
...指定したコマンドのリストをパイプで繋いで順番に実行します。
@param cmds 実行するコマンドのリストを指定します。それぞれのコマンドは
以下のように String か Array で指定します。
commandline にはコマン......options には Hash で指定します。
env には環境変数を Hash で指定します。
cmdname にはコマンド名を表す String を指定します。
1、2、3 は shell 経由で実行されます。
(1) commandline
(2) [commandline, options]......(3) [env, commandline, options]
(4) [env, cmdname, arg1, arg2, ..., options]
(5) [env, [cmdname, argv0], arg1, ..., options]
@return ブロックを指定した場合はブロックの最後に評価された値を返します。
ブロックを指定しなかった場合は実行した...