Module: Net::SSH::PromptMethods::Termios

Defined in:
lib/net/ssh/prompt.rb

Overview

Defines the prompt method to use if the Termios library is installed.

Instance Method Summary collapse

Instance Method Details

#prompt(prompt, echo = true) ⇒ Object

Displays the prompt to $stdout. If echo is false, the Termios library will be used to disable keystroke echoing for the duration of this method.


27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/net/ssh/prompt.rb', line 27

def prompt(prompt, echo=true)
  $stdout.print(prompt)
  $stdout.flush

  set_echo(false) unless echo
  $stdin.gets.chomp
ensure
  if !echo
    set_echo(true)
    $stdout.puts
  end
end