るりまサーチ

最速Rubyリファレンスマニュアル検索!
33件ヒット [1-33件を表示] (0.034秒)

別のキーワード

  1. _builtin systemexit
  2. systemexit success?
  3. systemexit new
  4. exit systemexit

クラス

モジュール

キーワード

検索結果

SystemExit#status -> Integer (27139.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...

SystemExit.new(status = 0, error_message = "") -> SystemExit (9238.0)

SystemExit オブジェクトを生成して返します。

...
SystemExit
オブジェクトを生成して返します。

@param status 終了ステータスを整数で指定します。

@param error_message エラーメッセージを文字列で指定します。

例:

ex = SystemExit.new(1)
p ex.status # => 1...

Kernel.#exit(status = true) -> () (149.0)

Rubyプログラムの実行を終了します。status として整 数が与えられた場合、その値を Ruby コマンドの終了ステータスとします。 デフォルトの終了ステータスは 0(正常終了)です。

...Rubyプログラムの実行を終了します。status として整
数が与えられた場合、その値を Ruby コマンドの終了ステータスとします。
デフォルトの終了ステータスは 0(正常終了)です。

status
が true の場合 0、 false の場合 1 を引数に...
...で、正確には環境依存です。

exit は例外 SystemExit を発生させ
ることによってプログラムの実行を終了させますので、
必要に応じて begin 節で捕捉することができます。

@param status 終了ステータスを整数か true または false で...
...uts '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...
#終了ステー...