`dpkg -l $package` will return 0 if the package has been purged, so a
proper test for it instead. Also add a pair of quotes to make `dpkg
--compare-versions` not complain.
end
Facter.add("tor_ge_0_2_9") do
setcode do
- system(%{dpkg -l tor >/dev/null 2>&1 && dpkg --compare-versions $(dpkg-query -W -f='${Version}' tor) ge 0.2.9})
+ system(%{test -n "$(dpkg-query -W -f='${Version}' tor)" && dpkg --compare-versions "$(dpkg-query -W -f='${Version}' tor)" ge 0.2.9})
end
end