Rake task: Use ``spawn`` instead of popen4 to avoid full pipes.

This commit is contained in:
Mitchell Hashimoto 2011-11-13 19:51:26 -08:00
parent 48a6ec29e8
commit 265aec2ad9
1 changed files with 3 additions and 6 deletions

View File

@ -27,10 +27,10 @@ namespace :acceptance do
if box_file.exist? if box_file.exist?
print "Box exists, checking SHA1 sum... " print "Box exists, checking SHA1 sum... "
if checksum.checksum == box["checksum"] if checksum.checksum == box["checksum"]
puts "OK" print "OK\n"
next next
else else
puts "FAIL" print "FAIL\n"
end end
end end
@ -39,13 +39,10 @@ namespace :acceptance do
# TODO: This isn't Windows friendly yet. Move to a OS-independent # TODO: This isn't Windows friendly yet. Move to a OS-independent
# download. # download.
pid, _stdin, stdout, stderr = pid = POSIX::Spawn.spawn("wget", box["url"], "-O", box_file.to_s)
POSIX::Spawn.popen4("wget", box["url"], "-O", box_file.to_s)
pid, status = Process.waitpid2(pid) pid, status = Process.waitpid2(pid)
if status.exitstatus != 0 if status.exitstatus != 0
puts "Download failed!" puts "Download failed!"
puts stdout.read
puts stderr.read
abort abort
end end