Skip to content

Commit

Permalink
phpversion fact: Don't output errors of php is not found
Browse files Browse the repository at this point in the history
Fixes jippi#134.
  • Loading branch information
fpletz committed Dec 10, 2015
1 parent eb77d0e commit 03dac75
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/facter/phpversion.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
Facter.add(:phpversion) do
setcode do
Facter::Util::Resolution.exec('php -v').
split("\n").first.split(' ').
select { |x| x =~ /^(?:(\d+)\.)(?:(\d+)\.)?(\*|\d+)/ }.first
output = Facter::Util::Resolution.exec('php -v')

unless output.nil?
output.split("\n").first.split(' ').
select { |x| x =~ /^(?:(\d+)\.)(?:(\d+)\.)?(\*|\d+)/ }.first
end
end
end

0 comments on commit 03dac75

Please sign in to comment.