    # File lib/chef/provider/package/pacman.rb, line 52
            def candidate_version
              return @candidate_version if @candidate_version

              status = popen4("pacman -Ss #{@new_resource.package_name}") do |pid, stdin, stdout, stderr|
                stdout.each do |line|
                  case line
                    when /^(extra|core|community)\/#{Regexp.escape(@new_resource.package_name)} (.+)$/
                      # $2 contains a string like "4.4.0-1 (kde kdenetwork)" or "3.10-4 (base)"
                      # simply split by space and use first token
                      @candidate_version = $2.split(" ").first
                  end
                end
              end

              unless status.exitstatus == 0 || status.exitstatus == 1
                raise Chef::Exceptions::Package, "pacman failed - #{status.inspect}!"
              end

              unless @candidate_version
                raise Chef::Exceptions::Package, "pacman does not have a version of package #{@new_resource.package_name}"
              end

              @candidate_version

            end