diff --git a/lib/vagrant-lxc/driver/cli.rb b/lib/vagrant-lxc/driver/cli.rb index 6c676bb..ba075b4 100644 --- a/lib/vagrant-lxc/driver/cli.rb +++ b/lib/vagrant-lxc/driver/cli.rb @@ -119,7 +119,7 @@ module Vagrant def supports_attach_with_namespaces? unless defined?(@supports_attach_with_namespaces) - @supports_attach_with_namespaces = run(:attach, '-h', '2>&1').include?('--namespaces') + @supports_attach_with_namespaces = run(:attach, '-h', :show_stderr => true).values.join.include?('--namespaces') end return @supports_attach_with_namespaces diff --git a/lib/vagrant-lxc/sudo_wrapper.rb b/lib/vagrant-lxc/sudo_wrapper.rb index 6966496..c6ba2b7 100644 --- a/lib/vagrant-lxc/sudo_wrapper.rb +++ b/lib/vagrant-lxc/sudo_wrapper.rb @@ -58,7 +58,14 @@ module Vagrant # Return the output, making sure to replace any Windows-style # newlines with Unix-style. - r.stdout.gsub("\r\n", "\n") + if opts[:show_stderr] + { + :stdout => r.stdout.gsub("\r\n", "\n"), + :stderr => r.stderr.gsub("\r\n", "\n") + } + else + r.stdout.gsub("\r\n", "\n") + end end def raw(*command, &block)