ライブラリ
- ビルトイン (216)
-
bigdecimal
/ math (12) - cmath (24)
- open3 (108)
- pty (24)
- syslog (48)
- timeout (21)
-
win32
/ registry (192)
モジュール
キーワード
- CloseKey (12)
- CreateKey (12)
- DeleteKey (12)
- DeleteValue (12)
- EnumKey (12)
- EnumValue (12)
- FlushKey (12)
- OpenKey (12)
- QueryInfoKey (12)
- QueryValue (12)
- SetValue (12)
- acos (12)
- asin (12)
- check (12)
- cos (12)
- cos! (6)
- detach (12)
- exp (6)
- getpgid (12)
- getpty (12)
- getsid (12)
- kill (12)
- open (24)
- open! (12)
- packdw (12)
- packqw (12)
- pid (12)
- pipe? (12)
- pipeline (12)
-
pipeline
_ r (24) -
pipeline
_ rw (24) -
pipeline
_ start (24) -
pipeline
_ w (24) - ppid (12)
- printf (24)
- reopen (12)
- setpgid (12)
- sin (12)
- sin! (6)
- spawn (12)
- tan! (6)
- timeout (21)
- unpackdw (12)
- unpackqw (12)
- wait (12)
- wait2 (12)
- waitpid (12)
- waitpid2 (12)
検索結果
先頭5件
-
Open3
. # pipeline(*cmds) -> [Process :: Status] (6201.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。
...それぞれのコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環......名を表す 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 実行した......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::Status: pid 11828 exit 0>]
例2:
require "open3"
Open3.pipeline([{"LANG"=>"C"}, "env"], ["grep",... -
Open3
. # pipeline _ r(*cmds) -> [IO , [Thread]] (6201.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。最後の コマンドの標準出力を受けとる事ができます。
...それぞれのコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環......名を表す 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 ブロック......します。
例:
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]] (6201.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。最初の コマンドの標準入力に書き込む事も最後のコマンドの標準出力を受けとる事も できます。
...それぞれのコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環......名を表す 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 ブロック......3"
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コマンド... -
Open3
. # pipeline _ w(*cmds) -> [IO , [Thread]] (6201.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。最初の コマンドの標準入力に書き込む事ができます。
...それぞれのコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環......名を表す 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 ブロック......た場合は最初に実行するコマンドの標準入力、
実行したプロセスを待つためのスレッドの配列を配列で返します。
例:
require "open3"
Open3.pipeline_w("bzip2 -c", :out=>"/tmp/hello.bz2") {|w, ts|
w.puts "hello"
}
@see Open3.#popen3... -
PTY
. # spawn(command) {|read , write , pid| . . . } -> nil (6201.0) -
擬似 tty を確保し、指定されたコマンドをその擬似 tty の向こうで実行し、配列を返します。
...擬似 tty を確保し、指定されたコマンドをその擬似 tty の向こうで実行し、配列を返します。
プラットフォームに依存しますが、対応していれば、作られたプロセスはセッションリーダーに
なり、その制御端末は作成され......た擬似 tty に設定されます。
@param command 擬似 tty 上で実行するコマンド
@return 返値は3つの要素からなる配列です。最初の要素は擬似 tty から
読み出すための IO オブジェクト、2番目の要素は書きこむための IO オブジ......素は子プロセスのプロセス ID です。
このメソッドがブロック付き呼ばれた場合、これらの要素はブロックパラメータとして渡され、
メソッド自体は nil を返します。
@see Kernel.#spawn, Kernel.#system, IO.popen, signal(2)... -
Process
. # detach(pid) -> Thread (6201.0) -
子プロセス pid の終了を監視するスレッドを生成して返します。 生成したスレッドは子プロセスが終了した後に終了ステータス (Process::Status) を返します。 指定した子プロセスが存在しなければ即座に nil で終了します。
...ス pid の終了を監視するスレッドを生成して返します。
生成したスレッドは子プロセスが終了した後に終了ステータス (Process::Status) を返します。
指定した子プロセスが存在しなければ即座に nil で終了します。
@param pid 子......。
@raise NotImplementedError メソッドが現在のプラットフォームで実装されていない場合に発生します。
pid = fork {
# child
sleep 3
}
p pid # => 7762
th = Process.detach(pid)
p th.value
# => #<Process::Status: pid 7762 exit 0>... -
Process
. # getpgid(pid) -> Integer (6201.0) -
プロセス ID が pid であるプロセスのプロセスグループ ID を整数で返します。
...プロセス ID が pid であるプロセスのプロセスグループ ID を整数で返します。
@param pid プロセス ID を整数で指定します。0 の時はカレントプロセス ID を指定したのと同じです。
@raise Errno::EXXX プロセスグループの取得に失......敗した場合に発生します。
@raise NotImplementedError メソッドが現在のプラットフォームで実装されていない場合に発生します。
@see getpgid(2)... -
Process
. # getsid(pid = 0) -> Integer (6201.0) -
引数 pid で指定されたプロセスのセッション ID を返します。
... pid で指定されたプロセスのセッション ID を返します。
@param pid プロセス ID を整数で指定します。省略した場合、0 を指定した場
合は現在のプロセスの ID を指定した場合と同じ動作になります。
@raise NotImplementedEr......ror メソッドが現在のプラットフォームで実装されて
いない場合に発生します。
Process.getsid() # => 27422
Process.getsid(0) # => 27422
Process.getsid(Process.pid()) # => 27422
@see getsid(2)... -
Process
. # pid -> Integer (6201.0) -
カレントプロセスのプロセス ID を返します。変数 $$ の値と同じです。
...カレントプロセスのプロセス ID を返します。変数 $$
の値と同じです。
@see getpid(2)... -
Process
. # ppid -> Integer (6201.0) -
親プロセスのプロセス ID を返します。UNIX では実際の親プロセスが終 了した後は ppid は 1 (initの pid)になります。
...親プロセスのプロセス ID を返します。UNIX では実際の親プロセスが終
了した後は ppid は 1 (initの pid)になります。
@see getppid(2)...