lib/ztk/ssh.rb in ztk-1.0.4 vs lib/ztk/ssh.rb in ztk-1.0.5
- old
+ new
@@ -128,19 +128,22 @@
# @option config [Integer] :compression_level What level of compression to
# use.
# @option config [String] :proxy_host_name Server hostname to proxy through.
# @option config [String] :proxy_user Username to use for proxy
# authentication.
+ # @option config [Boolean] :request_pty Weither or not we should try to
+ # obtain a PTY
# @option config [String, Array<String>] :proxy_keys A single or series of
# identity files to use for authentication with the proxy.
def initialize(configuration={})
super({
:forward_agent => true,
:compression => false,
:user_known_hosts_file => '/dev/null',
:timeout => 60,
- :ignore_exit_status => false
+ :ignore_exit_status => false,
+ :request_pty => true
}.merge(configuration))
config.ui.logger.debug { "config=#{config.send(:table).inspect}" }
end
# Starts an SSH session. Can also be used to get the Net::SSH object.
@@ -220,9 +223,17 @@
ZTK::RescueRetry.try(:tries => 3, :on => EOFError) do
@ssh = Net::SSH.start(options.host_name, options.user, ssh_options)
channel = ssh.open_channel do |chan|
options.ui.logger.debug { "Channel opened." }
+
+ (options.request_pty == true) and chan.request_pty do |ch, success|
+ if success
+ options.ui.logger.debug { "PTY obtained." }
+ else
+ options.ui.logger.warn { "Could not obtain PTY." }
+ end
+ end
direct_log(:info) { log_header("COMMAND") }
direct_log(:info) { "#{command}\n" }
direct_log(:info) { log_header("OPENED") }