# Make virtualenv version available as a fact

Facter.add('virtualenv_version') do
  setcode do
    if Facter::Util::Resolution.which('virtualenv')
      Facter::Util::Resolution.exec('virtualenv --version 2>&1').match(%r{(\d+\.\d+\.?\d*).*$})[1]
    end
  end
end

# Make virtualenv version available as a fact

Facter.add('virtualenv_version') do
  setcode do
    if Facter::Util::Resolution.which('virtualenv')
      results = Facter::Util::Resolution.exec('virtualenv --version 2>&1').match(%r{(\d+\.\d+\.?\d*).*$})
      results[1] if results
    end
  end
end

Improve handling of missing output of virtualenv version fact command
Improve handling of missing output of virtualenv version fact command

Partially fixes #527

Signed-off-by: Wiebe Verweij <10a6f3397f4f2d96521ed2f2df6a1f1a87254a52@moxio.com>
