`vagrant ssh -c` stderr now goes to stderr on the host as well

This commit is contained in:
Mitchell Hashimoto 2011-12-26 10:03:12 -08:00
parent e07280593d
commit f65a6c3c6f
4 changed files with 12 additions and 3 deletions

View File

@ -26,6 +26,8 @@
would be port collisions. [GH-602]
- `vagrant ssh -c` will now exit with the same exit code as the command
run. [GH-598]
- `vagrant ssh -c` will not send stderr to stderr and stdout to stdout
on the host machine, instead of all output to stdout.
## 0.8.10 (December 10, 2011)

View File

@ -48,9 +48,16 @@ module Vagrant
if type == :exit_status
exit_status = data.to_i
else
# Determine the proper channel to send the output onto depending
# on the type of data we are receiving.
channel = type == :stdout ? :out : :error
# Print the SSH output as it comes in, but don't prefix it and don't
# force a new line so that the output is properly preserved
vm.ui.info(data.to_s, :prefix => false, :new_line => false)
vm.ui.info(data.to_s,
:prefix => false,
:new_line => false,
:channel => channel)
end
end
end

View File

@ -80,7 +80,7 @@ module Vagrant
# Determine the proper IO channel to send this message
# to based on the type of the message
channel = type == :error ? $stderr : $stdout
channel = type == :error || opts[:channel] == :error ? $stderr : $stdout
# Output!
channel.send(printer, format_message(type, message, opts))

View File

@ -38,7 +38,7 @@ describe "vagrant ssh" do
result = execute("vagrant", "ssh", "-c", "foooooooooo")
result.exit_code.should == 127
#result.stderr.should =~ /foooooooooo: command not found/
result.stderr.should =~ /foooooooooo: command not found/
end
# TODO: