U
uncutstone
My OS is windows 98, and ruby version is ruby 1.8.2 (2004-12-25)
[i386-mswin32] .
The following is the code:
main.rb:
pipe = IO.popen("ruby saygoodbye.rb", "w+")
sleep 3
cpid = Process.wait
lines = pipe.readlines
puts lines
saygoodbye.rb:
34.times do
puts "Please take a look at what will happen, it's really
tricky"
end
$stderr.puts "child process #{Process.pid} exits"
The above code cannot execute as expected: the parent process will wait
for ever. When I use ctrl-c to break it , I got
main.rb:3:in `wait': Interrupt
from main.rb:3
But if I change 34.times in saygoodbye.rb to 33.times, it works well.
So , it seems there is a limit of pipe's capacity.
Somebody can give me a clear explanation, Very thanks.
[i386-mswin32] .
The following is the code:
main.rb:
pipe = IO.popen("ruby saygoodbye.rb", "w+")
sleep 3
cpid = Process.wait
lines = pipe.readlines
puts lines
saygoodbye.rb:
34.times do
puts "Please take a look at what will happen, it's really
tricky"
end
$stderr.puts "child process #{Process.pid} exits"
The above code cannot execute as expected: the parent process will wait
for ever. When I use ctrl-c to break it , I got
main.rb:3:in `wait': Interrupt
from main.rb:3
But if I change 34.times in saygoodbye.rb to 33.times, it works well.
So , it seems there is a limit of pipe's capacity.
Somebody can give me a clear explanation, Very thanks.