るりまサーチ (Ruby 2.6.0)

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

別のキーワード

  1. kernel system
  2. kernel spawn
  3. kernel exec
  4. kernel open
  5. kernel gsub

ライブラリ

クラス

モジュール

検索結果

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

FileUtils#sh(*cmd) {|result, status| ... } (415.0)

与えられたコマンドを実行します。

与えられたコマンドを実行します。

与えられた引数が複数の場合、シェルを経由しないでコマンドを実行します。

@param cmd 引数の解釈に関しては Kernel.#exec を参照してください。


例:
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 = #...