method
_gets_noecho
Ruby latest stable (v2_5_5)
-
0 notes -
Class: StreamUI
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
_gets_noecho()
public
Hide source
# File lib/rubygems/user_interaction.rb, line 325 def _gets_noecho require_io_console if IO.method_defined?(:noecho) then @ins.noecho {@ins.gets} elsif Gem.win_platform? require "Win32API" 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 password else system "stty -echo" begin @ins.gets ensure system "stty echo" end end end