Ruby 2.2.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > SystemExitクラス > status

instance method SystemExit#status

status -> Integer[permalink][rdoc]

例外オブジェクトに保存された終了ステータスを返します。

終了ステータスは Kernel.#exitSystemExit.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