Created
October 24, 2016 09:16
-
-
Save yossywolf/5ead23512dc7459d548b1eeea9bc86f8 to your computer and use it in GitHub Desktop.
実行ファイルが無い場合, 実行できたけどなんか失敗している場合を把握
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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