SystemExit

ruby を終了させます。*1

スーパークラス:

メソッド:

status ((<ruby 1.7 feature>))

exit により終了したとき、その引数(終了ステータス) を返します。

begin
  exit(1)
rescue SystemExit
  p $!
  p $!.status
end

=> #<SystemExit: exit>
   1

SystemExit の例外を故意に発生させた場合の値は nil です。

begin
  raise SystemExit, "bogus exit"
rescue SystemExit
  p $!
  p $!.status
end

=> #<SystemExit: bogus exit>
   nil

*1exitとは少し違いがあります。ruby-dev:12785[外部]