diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c957a75a..0e9bd3d8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.9.6 (unreleased) - + - Fix strange issue with inconsistent childprocess reads on JRuby. [GH-711] ## 0.9.5 (February 5, 2012) diff --git a/lib/vagrant/util/subprocess.rb b/lib/vagrant/util/subprocess.rb index 8778133ed..56eee94d0 100644 --- a/lib/vagrant/util/subprocess.rb +++ b/lib/vagrant/util/subprocess.rb @@ -116,10 +116,6 @@ module Vagrant rescue ChildProcess::TimeoutError raise TimeoutExceeded, process.pid end - - # Close the writer pipes, since we're just reading - stdout_writer.close - stderr_writer.close @logger.debug("Exit status: #{process.exit_code}") @@ -140,6 +136,12 @@ module Vagrant yield io_name, extra_data if block_given? end + # Close the writer pipes. Note that we do this so late (after the process + # has quit) to work around an issue with childprocess and JRuby. It is + # bizarre but it works. + stdout_writer.close + stderr_writer.close + # Return an exit status container return Result.new(process.exit_code, io_data[:stdout], io_data[:stderr]) end