1 |
On Sat, 02 Jun 2012 18:04:41 -0700 |
2 |
Zac Medico <zmedico@g.o> wrote: |
3 |
|
4 |
> #!/usr/bin/env bash |
5 |
> named_pipe=$(mktemp -d)/fifo |
6 |
> |
7 |
> ( |
8 |
> # hold the pipe open in read mode, so |
9 |
> # the writer doesn't block |
10 |
> sleep 3 |
11 |
> ) < "$named_pipe" & |
12 |
|
13 |
I don't understand this part. This keeps the pipe open for reading |
14 |
which obviously causes it to lose data. If you open it, you need to |
15 |
read all that is there and then close. |
16 |
|
17 |
And writers are supposed to be blocked. They are forked and just write |
18 |
when done, so there's no problem with keeping them alive for a short |
19 |
while. |
20 |
|
21 |
-- |
22 |
Best regards, |
23 |
Michał Górny |