I'm using the following to have a program listen on a fifo and take
action whenever input becomes available. The fifo should be used like
a device under /dev, like:
$ echo 'hello world' >fifo
Is there any better/nicer way?
fifo = 'foo'
`mkfifo #{fifo}` if not File.exists?(fifo)
loop do
f = File.open(fifo, File::RDONLY | File::NONBLOCK)
select [f]
p f.read
end
Massimiliano