lib/vagrant/util/subprocess.rb in vagrant-unbundled-2.2.9.0 vs lib/vagrant/util/subprocess.rb in vagrant-unbundled-2.2.10.0

- old
+ new

@@ -88,10 +88,12 @@ stdout, stdout_writer = ::IO.pipe stderr, stderr_writer = ::IO.pipe process.io.stdout = stdout_writer process.io.stderr = stderr_writer process.duplex = true + process.leader = true if @options[:detach] + process.detach = true if @options[:detach] # Special installer-related things if Vagrant.in_installer? installer_dir = Vagrant.installer_embedded_dir.to_s.downcase @@ -156,10 +158,16 @@ # Raise our own version of the error so that users of the class # don't need to be aware of ChildProcess raise LaunchError.new(ex.message) end + # If running with the detach option, no need to capture IO or + # ensure program exists. + if @options[:detach] + return + end + # Make sure the stdin does not buffer process.io.stdin.sync = true if RUBY_PLATFORM != "java" # On Java, we have to close after. See down the method... @@ -259,10 +267,10 @@ end # Return an exit status container return Result.new(process.exit_code, io_data[:stdout], io_data[:stderr]) ensure - if process && process.alive? + if process && process.alive? && !@options[:detach] # Make sure no matter what happens, the process exits process.stop(2) end end