Most of the facts in core Facter that execute arbitrary commands on the system use Facter::Util::Resolution.exec with the command as an argument. The output of that command is then captured or parsed before used in determining the end fact.
For example, the memtotal fact uses the following code:
memtotal = Facter::Util::Resolution.exec("sysctl hw.physmem | cut -d'=' -f2")
And hostname uses the following code in one case:
exec searches the path for the command, so if the binary is not in the current path, it must be fully qualified.
Double Edit ... (more)