diff --git a/plugins/communicators/ssh/communicator.rb b/plugins/communicators/ssh/communicator.rb index ac6589591..6ae96cc39 100644 --- a/plugins/communicators/ssh/communicator.rb +++ b/plugins/communicators/ssh/communicator.rb @@ -287,6 +287,16 @@ module VagrantPlugins # Open the channel so we can execute or command channel = connection.open_channel do |ch| + if @machine.config.ssh.pty + ch.request_pty do |ch2, success| + if success + @logger.debug("pty obtained for connection") + else + @logger.warn("failed to obtain pty, will try to continue anyways") + end + end + end + ch.exec(shell_cmd) do |ch2, _| # Setup the channel callbacks so we can get data and exit status ch2.on_data do |ch3, data| diff --git a/plugins/kernel_v2/config/ssh.rb b/plugins/kernel_v2/config/ssh.rb index 883697acb..e39ec65ce 100644 --- a/plugins/kernel_v2/config/ssh.rb +++ b/plugins/kernel_v2/config/ssh.rb @@ -11,6 +11,7 @@ module VagrantPlugins attr_accessor :keep_alive attr_accessor :shell attr_accessor :proxy_command + attr_accessor :pty attr_reader :default @@ -22,6 +23,7 @@ module VagrantPlugins @guest_port = UNSET_VALUE @keep_alive = UNSET_VALUE @proxy_command = UNSET_VALUE + @pty = UNSET_VALUE @shell = UNSET_VALUE @default = SSHConnectConfig.new @@ -42,6 +44,7 @@ module VagrantPlugins @guest_port = nil if @guest_port == UNSET_VALUE @keep_alive = false if @keep_alive == UNSET_VALUE @proxy_command = nil if @proxy_command == UNSET_VALUE + @pty = false if @pty == UNSET_VALUE @shell = nil if @shell == UNSET_VALUE @default.finalize!