Files
metasploit-gs/lib/rex/ui/text/input/stdio.rb
T
Matt Miller b6a8514afe fix prompt display for stdio mode
git-svn-id: file:///home/svn/incoming/trunk@3251 4d416f70-5f16-0410-b530-b9f4589650da
2005-12-21 04:32:06 +00:00

54 lines
687 B
Ruby

require 'rex/ui'
module Rex
module Ui
module Text
###
#
# This class implements input against standard in.
#
###
class Input::Stdio < Rex::Ui::Text::Input
#
# Reads text from standard input.
#
def sysread(len = 1)
$stdin.sysread(len)
end
#
# Wait for a line of input to be read from standard input.
#
def gets
return $stdin.gets
end
#
# Print a prompt and flush standard output.
#
def _print_prompt(prompt)
$stdout.print(prompt)
$stdout.flush
end
#
# Returns whether or not EOF has been reached on stdin.
#
def eof?
$stdin.closed?
end
#
# Returns the file descriptor associated with standard input.
#
def fd
return $stdin
end
end
end
end
end