def ask_for_password_on_windows
      return nil if not tty?

      require "Win32API"
      char = nil
      password = ''

      while char = Win32API.new("crtdll", "_getch", [ ], "L").Call do
        break if char == 10 || char == 13 # received carriage return or newline
        if char == 127 || char == 8 # backspace and delete
          password.slice!(-1, 1)
        else
          password << char.chr
        end
      end

      puts
      password
    end
#
Asks for a password that works on windows. Ripped from the Heroku gem.