41件ヒット
[1-41件を表示]
(0.044秒)
検索結果
先頭4件
-
Open3
. # pipeline _ start(*cmds) -> [Thread] (108.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。
...ッ
ドの配列を返します。
例:
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... -
Timeout
. # timeout(sec , exception _ class = nil) {|i| . . . } -> object (13.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...out(5, MYError) {
sleep(30)
}
rescue MYError => err
puts "MYError"
puts err
end
=== 注意
timeout による割り込みは Thread によって実現されています。
C 言語レベルで実装され、
Ruby のスレッドが割り込めない処理に対して timeout.......pid
while line = com.gets
print line
end
}
rescue Timeout::Error => err
puts "timeout: shell execution."
Process.kill('SIGINT', pid)
printf "[result]\t%s", com.read
com.close unless com.nil?
end
#止まっているか確認する。
#system("ps au")... -
Timeout
. # timeout(sec , exception _ class , message) {|i| . . . } -> object (13.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...out(5, MYError) {
sleep(30)
}
rescue MYError => err
puts "MYError"
puts err
end
=== 注意
timeout による割り込みは Thread によって実現されています。
C 言語レベルで実装され、
Ruby のスレッドが割り込めない処理に対して timeout.......pid
while line = com.gets
print line
end
}
rescue Timeout::Error => err
puts "timeout: shell execution."
Process.kill('SIGINT', pid)
printf "[result]\t%s", com.read
com.close unless com.nil?
end
#止まっているか確認する。
#system("ps au")... -
Open3
. # pipeline _ start(*cmds) {|wait _ thrs| . . . } -> () (8.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。
...ッ
ドの配列を返します。
例:
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...