クラス
- Mutex (2)
-
Net
:: HTTP (44) - SystemExit (11)
-
Thread
:: Mutex (9)
キーワード
-
$ CHILD _ STATUS (11) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - Application (1)
- exit (11)
- exit! (11)
- post2 (22)
-
request
_ post (22) -
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 4 feature (11) - sh (11)
- sleep (11)
- status (11)
-
test
/ unit (1)
検索結果
先頭5件
-
Process
:: Status (18078.0) -
プロセスの終了ステータスを表すクラスです。 メソッド Process.#wait2 などの返り値として使われます。
...クラスです。
メソッド Process.#wait2 などの返り値として使われます。
=== 使用例
wait を使用した例
fork { exit }
Process.wait
case
when $?.signaled?
p "child #{$?.pid} was killed by signal #{$?.termsig}"
if $?.coredump? # システムがこのス......p "child #{$?.pid} dumped core."
end
when $?.stopped?
# 実際には Process.wait を使用しているので、ここに来ることはない
p "child #{$?.pid} was stopped by signal #{$?.stopsig}"
when $?.exited?
p "child #{$?.pid} exited normally. status=#{$?.exitstatus}"
e...... status %#x" % $?.to_i
end
SIGCHLD を trap する例
trap(:SIGCHLD) {|sig|
puts "interrupted by signal #{sig} at #{caller[1]}"
# 複数の子プロセスの終了に対して1つの SIGCHLD しか届かない
# 場合があるのでループさせる必要があります
whi... -
Kernel
$ $ CHILD _ STATUS -> Process :: Status | nil (12420.0) -
$? の別名
...$? の別名
require "English"
out = `wget https://www.ruby-lang.org/en/about/license.txt -O - 2>/dev/null`
if $CHILD_STATUS.to_i == 0
print "wget success\n"
out.split(/\n/).each { |line|
printf "%s\n", line
}
else
print "wget failed\n"
end... -
SystemExit
# status -> Integer (9225.0) -
例外オブジェクトに保存された終了ステータスを返します。
...します。
終了ステータスは Kernel.#exit や SystemExit.new などで設定されます。
例:
begin
exit 1
rescue SystemExit => err
p err.status # => 1
end
begin
raise SystemExit.new(1, "dummy exit")
rescue SystemExit => err
p err.status # => 1
end... -
Kernel
. # exit(status = true) -> () (6271.0) -
Rubyプログラムの実行を終了します。status として整 数が与えられた場合、その値を Ruby コマンドの終了ステータスとします。 デフォルトの終了ステータスは 0(正常終了)です。
...Rubyプログラムの実行を終了します。status として整
数が与えられた場合、その値を Ruby コマンドの終了ステータスとします。
デフォルトの終了ステータスは 0(正常終了)です。
status が true の場合 0、 false の場合 1 を引数に......定数
EXIT_SUCCESS、EXIT_FAILURE の値なので、正確には環境依存です。
exit は例外 SystemExit を発生させ
ることによってプログラムの実行を終了させますので、
必要に応じて begin 節で捕捉することができます。
@param status 終了ス......mlist[例][ruby]{
puts 'start'
begin
puts 'start1...'
exit
rescue SystemExit => err
puts "end1 with #{err.inspect}"
end
begin
puts 'start2...'
exit
ensure
puts 'end2...'
end
puts 'end' #実行されない
#=> start
# start1...
# end1 with #<SystemExit: exit>
# start2...
# end2.... -
Kernel
. # exit!(status = false) -> () (6247.0) -
Rubyプログラムの実行を即座に終了します。 status として整数が与えられた場合、その値を Ruby コマンドの終了ステータスとします。 デフォルトの終了ステータスは 1 です。
...Rubyプログラムの実行を即座に終了します。
status として整数が与えられた場合、その値を Ruby コマンドの終了ステータスとします。
デフォルトの終了ステータスは 1 です。
status が true の場合 0、 false の場合 1 を引数に指......ルの定数
EXIT_SUCCESS、EXIT_FAILURE の値なので、正確には環境依存です。
exit! は exit とは違って、例外処理などは一切行ないませ
ん。 Kernel.#fork の後、子プロセスを終了させる時などに用
いられます。
@param status 終了ステータ......す。
//emlist[例][ruby]{
STDOUT.sync = true #表示前に終了しないようにする
puts 'start'
begin
puts 'start1...'
exit!
ensure
puts 'end1...' #実行されない
end
puts 'end' #実行されない
#=> start
# start1...
#終了ステータス:1
//}
@see Kernel.#exit,Kernel.#ab... -
FileUtils
# sh(*cmd) {|result , status| . . . } (6125.0) -
与えられたコマンドを実行します。
...参照してください。
例:
sh %{ls -ltr}
sh 'ls', 'file with spaces'
# check exit status after command runs
sh %{grep pattern file} do |ok, res|
if ! ok
puts "pattern not found (status = #{res.exitstatus})"
end
end
@see Kernel.#exec, Kernel.#system... -
test
/ unit (6060.0) -
ユニットテストを行うためのライブラリです。
...してください。
* Test::Unit - Ruby用単体テストフレームワーク: https://test-unit.github.io/
なお、2.2.0より前のtest/unit は当時バンドルしていた minitest/unit を使って再実装し
ていましたが、上記のtest/unitと完全な互換性がある訳で......* RubyKaigi 2015:The history of testing framework in Ruby https://www.clear-code.com/blog/2015/12/12.html
=== 使い方
Test::Unit は以下のように使います。
まずテスト対象のソース(foo.rb)が必要です。
class Foo
def foo
"foo"
end
de......options:
-h, --help Display this help.
-s, --seed SEED Sets random seed
-v, --verbose Verbose. Show progress processing files.
-n, --name PATTERN Filter test names on pattern.
--jobs-status [TY... -
Logger
:: Application (6024.0) -
ユーザ定義のアプリケーションにログ機能を簡単に追加することができます。
...App < Application
def initialize(foo_app, application_specific, arguments)
super('FooApp') # Name of the application.
end
def run
...
log(WARN, 'warning', 'my_method1')
...
@log.error('my_method2') { 'Error!' }
...
end
end
status = FooApp.......new(....).start
=== 注意
このクラスは 2.2.0 で gem ライブラリとして切り離されました。2.2.0
以降ではそちらを利用してください。
* https://rubygems.org/gems/logger-application... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (1434.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...の変更点(まとめ)/Windows 対応>))
* ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>))
* ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>))
* ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>))
* ((<1.6.8から1.8.0......s << Object
p [self.id, self]
class << self
p [self.id, self]
end
end
=> ruby 1.6.7 (2002-03-01) [i586-linux]
[537771634, Class]
[537742484, Class]
=> ruby 1.7.3 (2002-09-05) [i586-linux]
[537771634, #......(2002-12-24) [i586-linux]
[1]
=> ruby 1.7.1 (2001-06-05) [i586-linux]
1
== 追加されたクラス/モジュール
: ((<Process::UID>)) [new]
: ((<Process::GID>)) [new]
: ((<Process::Sys>)) [new]
: ((<Signal>)) モジュール [new]
: ((<Process::Status>)) [ne... -
ruby 1
. 6 feature (1362.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...ruby 1.6 feature
ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン
になります。
((<stable-snapshot|URL:ftp://ftp.netlab.co.jp/pub/lang/ruby/stable-snapshot.tar.gz>)) は、日々更新される安定版の最新ソースです。
== 1.6.8 (2002-12-24) ->......込み可能になったのに
空配列が返されるという問題なのだそうです) ((<ruby-talk:40015>)),
((<ruby-win32:366>))
: 2002-09-12: Thread.status (?)
シグナルを trap でトラップしたときにスレッドの状態を保持していなかっ
たためシグナル......rityError)
=> ruby 1.6.7 (2002-07-30) [i586-linux]
: 2002-05-20 IO#close
双方向のパイプの dup を close_write するとエラーになっていました。
((<ruby-dev:17155>))
open("|-","r+") {|f|
if f
f.dup.close_write
else
sleep 1
end... -
ruby 1
. 8 . 4 feature (198.0) -
ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。
...更
# * [api]: 拡張ライブラリ API
# * [lib]: ライブラリ
* レベル
* [bug]: バグ修正
* [new]: 追加されたクラス/メソッドなど
* [compat]: 変更されたクラス/メソッドなど
* 互換性のある変更
* only backward-compatibility
* 影...... if valid as a symbol name more strictly. [ruby-dev:27478]
#
# * test/ruby/test_symbol.rb: tests for [ruby-core:03573].
Symbolに適合する文字列を厳密にした。((<ruby-core:03573>)),((<ruby-dev:27478>))
1) alias :"foo" :"bar"
def bar; p "bar"; end......ActiveTcl8.4.12.0 またはそれ以前
( beta 版 は ActiveTcl8.5.0.0b4 またはそれ以前 )
に含まれるものに対応しています.
対応している Tcl/Tk 拡張の種類とバージョンとは
ext/tk/lib/tkextlib/SUPPPORT_STATUS...