(#9461) Resolve executables using PATHEXT on Windows
Previously, 'puppet resource package' fails on Windows when attempting
to invoke the 'gem' executable, because on Windows, 'gem' is a ruby
script which must be executed by calling the batch wrapper, 'gem.bat'.
This commit modifies Puppet::Util.which such that if a non-absolute
path is given, then for each directory in PATH, and each extension in
PATHEXT, it returns the first file that exists and is executable. If
the PATHEXT environment variable is not defined, then it defaults to
the same values that cmd.exe uses and are known to work across all
Windows versions.