Skip to content

Commit

Permalink
Merge pull request #238 from xaque208/python3factfix
Browse files Browse the repository at this point in the history
Check that we have results before returning a value
  • Loading branch information
Shiva Poudel committed Sep 7, 2015
2 parents 2111486 + 44728ef commit 676f705
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/facter/python_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

def get_python_version(executable)
if Facter::Util::Resolution.which(executable)
Facter::Util::Resolution.exec("#{executable} -V 2>&1").match(/^.*(\d+\.\d+\.\d+)$/)[1]
results = Facter::Util::Resolution.exec("#{executable} -V 2>&1").match(/^.*(\d+\.\d+\.\d+)$/)
if results
results[1]
end
end
end

Expand Down

0 comments on commit 676f705

Please sign in to comment.