# File lib/facter/util/resolution.rb, line 117
  def self.exec(code, interpreter = nil)
    Facter.warnonce "The interpreter parameter to 'exec' is deprecated and will be removed in a future version." if interpreter

    if expanded_code = expand_command(code)
      # if we can find the binary, we'll run the command with the expanded path to the binary
      code = expanded_code
    else
      # if we cannot find the binary return nil on posix. On windows we'll still try to run the
      # command in case it is a shell-builtin. In case it is not, windows will raise Errno::ENOENT
      return nil unless Facter::Util::Config.is_windows?
      return nil if absolute_path?(code)
    end

    out = nil

    begin
      out = %x{#{code}}.chomp
      Facter.warnonce 'Using Facter::Util::Resolution.exec with a shell built-in is deprecated. Most built-ins can be replaced with native ruby commands. If you really have to run a built-in, pass "cmd /c your_builtin" as a command' unless expanded_code
    rescue Errno::ENOENT => detail
      # command not found on Windows
      return nil
    rescue => detail
      $stderr.puts detail
      return nil
    end

    if out == ""
      return nil
    else
      return out
    end
  end