Project

General

Profile

Bug #10583 ยป spawn_bug_example.rb

Example Testcase - ezran (Justin Greer), 12/09/2014 05:44 PM

 
# Just set up a fifo to work with.
require 'tempfile'
fifo_path = File.join(Dir.tmpdir, 'spawn_fifo')
`mkfifo '#{fifo_path}'`

puts "BEFORE SPAWN"
spawned_pid = Process.spawn("echo hello world", STDOUT => fifo_path, :close_others => true)
########################### STALLS HERE ###########################
puts "AFTER SPAWN"


# If spawn worked in this case, then we could read the data from the fifo and display it.
data = File.read(fifo_path)
puts data
Process.waitpid(spawned_pid)

    (1-1/1)