ceb69e6266
Previously, there was no way to close the STDIN stream of a subprocess, so commands that read from stdin in a subprocess would hang forever, such as `/bin/sh -s`. If one tried to close the stdin, the IO.select() call in Subprocess#execute would raise an error for calling select() on a closed IO. Here's a concrete example of a command that needs to close STDIN to work properly: ```ruby script = SOME_VERY_LONG_STRING command = %w(ssh foo.example.com /bin/sh -s foo bar) result = ::Vagrant::Util::Subprocess.execute(*command) do |type, data_or_io| if type == :stdin data_or_io.write(script) data_or_io.write("\n") data_or_io.close next end puts "Remote: #{data_or_io}" end ``` |
||
---|---|---|
.. | ||
vagrant | ||
vagrant.rb |