# File lib/mcollective/util.rb, line 524 def self.get_hidden_input_on_windows() require 'Win32API' # Hook into getch from crtdll. Keep reading all keys till return # or newline is hit. # If key is backspace or delete, then delete the character and update # the buffer. input = '' while char = Win32API.new("crtdll", "_getch", [ ], "I").Call do break if char == 10 || char == 13 # return or newline if char == 127 || char == 8 # backspace and delete if input.length > 0 input.slice!(-1, 1) end else input << char.chr end end char = '' input end