Fetching program exit status by facter
I'm looking to check whether the Java package is installed on OSX by executing
pkgutil --pkgs=.+Java.+ and looking at its exit status.
Based on that, I'll decide whether I should execute
java -version. Executing
java -version when the package is not installed will result in an error (it prints some message about having to install Java).
I'm looking for the "right" way to fetch the exit code while executing the fact's
Is there such a way?
(in case this matters, the context of this is that I want to port the puppetlabs-java module to OSX based on code from https://github.com/skoblenick/puppet-..., since I can't install both modules in parallel).