class Net::SSH::Connection::Channel
def request_pty(opts = {}, &block)
end
puts "could not obtain pty"
else
puts "pty successfully obtained"
if success
channel.request_pty do |ch, success|
run when a pty is not present.
scripts (.bashrc and such) are not run by default, whereas they are
Note, too, that when a pty is requested, user's shell configuration
instead of prompt if they ever need some user interaction.
some systems, will not be able to run interactively, and will error
Note, that without a pty some programs (e.g. sudo, or subversion) on
screen-based program (e.g., vim, or some menuing system).
This is useful when you want to invoke and interact with some kind of
Requests that a pseudo-tty (or "pty") be made available for this channel.
def request_pty(opts = {}, &block) extra = opts.keys - VALID_PTY_OPTIONS.keys raise ArgumentError, "invalid option(s) to request_pty: #{extra.inspect}" if extra.any? opts = VALID_PTY_OPTIONS.merge(opts) modes = opts[:modes].inject(Buffer.new) do |memo, (mode, data)| memo.write_byte(mode).write_long(data) end # mark the end of the mode opcode list with a 0 byte modes.write_byte(0) send_channel_request("pty-req", :string, opts[:term], :long, opts[:chars_wide], :long, opts[:chars_high], :long, opts[:pixels_wide], :long, opts[:pixels_high], :string, modes.to_s, &block) end