Skip to content

Instantly share code, notes, and snippets.

@yossywolf
Created October 24, 2016 09:16
Show Gist options
  • Save yossywolf/5ead23512dc7459d548b1eeea9bc86f8 to your computer and use it in GitHub Desktop.
Save yossywolf/5ead23512dc7459d548b1eeea9bc86f8 to your computer and use it in GitHub Desktop.
実行ファイルが無い場合, 実行できたけどなんか失敗している場合を把握
require "open3"
begin
# ここで実行
out, err, status = Open3.capture3("ls --option")
# 実行ファイルはあるがなんか失敗している場合
if err.length != 0 then
print("実行できましたが失敗しています\n" + err)
end
# 実行ファイルが無い…など
rescue => e
print("実行できませんでした\n" + e.message)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment