A
Ara.T.Howard
can someone tell me the behaviour of these two programs run in separate
terminals under windows?
harp:~ > cat a.rb
system "mkfifo fifo >/dev/null 2>&1" # don't know how to do this in win
File::chmod 0777, "fifo"
t0 =
Thread::new do
loop do
open("fifo", File::RDONLY|File::NONBLOCK) do |fifo|
f = select([fifo]).first.first
STDERR.print f.read
end
end
end
t1 =
Thread::new do
loop do
STDERR.puts 42
sleep 0.42
end
end
gets
harp:~ > cat b.rb
loop do
open("fifo", File::WRONLY) do |f|
f.puts 'forty-two'
end
sleep 0.42
end
i expect the output to look something like:
42
42
42
42
42
forty-two
42
forty-two
42
forty-two
42
forty-two
...
...
cheers.
-a
--
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| Your life dwells amoung the causes of death
| Like a lamp standing in a strong breeze. --Nagarjuna
===============================================================================
terminals under windows?
harp:~ > cat a.rb
system "mkfifo fifo >/dev/null 2>&1" # don't know how to do this in win
File::chmod 0777, "fifo"
t0 =
Thread::new do
loop do
open("fifo", File::RDONLY|File::NONBLOCK) do |fifo|
f = select([fifo]).first.first
STDERR.print f.read
end
end
end
t1 =
Thread::new do
loop do
STDERR.puts 42
sleep 0.42
end
end
gets
harp:~ > cat b.rb
loop do
open("fifo", File::WRONLY) do |f|
f.puts 'forty-two'
end
sleep 0.42
end
i expect the output to look something like:
42
42
42
42
42
forty-two
42
forty-two
42
forty-two
42
forty-two
...
...
cheers.
-a
--
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| Your life dwells amoung the causes of death
| Like a lamp standing in a strong breeze. --Nagarjuna
===============================================================================