# File lib/rhc/ssh_helpers.rb, line 432
    def discover_ssh_executable
      @ssh_executable ||= begin
        guessing_locations = ['ssh']

        #:nocov:
        if RHC::Helpers.windows?
          # looks for ssh.exe from msysgit or plink.exe from PuTTY, either on path or specific locations
          guessing_locations << 
            discover_windows_executables do |base|
              [ 
                'ssh.exe', 
                "#{base}\\Git\\bin\\ssh.exe", 
                "#{base}\\ssh.exe", 
                'plink.exe',
                "#{base}\\PuTTY\\plink.exe",
                "#{base}\\plink.exe",
                'putty.exe',
                "#{base}\\PuTTY\\putty.exe",
                "#{base}\\putty.exe" 
              ]
            end
        end
        #:nocov:

        # make sure commands can be executed and finally pick the first one
        guessing_locations.flatten.uniq.select do |cmd| 
          (check_ssh_executable!(cmd).present? rescue false) && 
          (begin
            # putty -V exit as 1
            cmd =~ /plink\.exe/i || cmd =~ /putty\.exe/i || (begin 
              ssh_version(cmd)
              $?.success?
            end)
          rescue ; false ; end)
        end.collect{|cmd| cmd =~ / / ? '"' + cmd + '"' : cmd}.first
      end
    end