Skip to content

Commit

Permalink
Wrap System.cmd call o try rescue
Browse files Browse the repository at this point in the history
  • Loading branch information
Cleidiano Oliveira authored and René Föhring committed Dec 11, 2020
1 parent 04dcaab commit ace2183
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/credo/build_info.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ defmodule Credo.BuildInfo do
end

defp git_present? do
{_, exit_status} = System.cmd("git", ["--help"])

exit_status == 0
try do
{_, exit_status} = System.cmd("git", ["--help"])
exit_status == 0
rescue
_ -> false
end
end

defp git_branch do
Expand Down

0 comments on commit ace2183

Please sign in to comment.