I've noticed a difference between Cygwin and Linux involving named
pipes. I don't know if this a bug or simply a difference.
Consider the following two scripts:
$ cat fifo1.sh
#!/bin/sh
set -x
rm -f foo
mkfifo foo
exec 7>foo
echo blah > foo
$ cat fifo2.sh
#!/bin/sh
set -x
read bar < foo
echo $bar
I run fifo1.sh in Terminal 1 and get the following on both Cygwin and Linux:
[Terminal 1]
$ ./fifo1.sh
+ rm -f foo
+ mkfifo foo
+ exec
The call to echo in the next line blocks, because foo has not yet been
opened for reading. Now I run fifo2.sh in Terminal 2. On Linux, the
"read" in fifo2.sh unblocks fifo1.sh, and I see the following:
[Terminal 1, Linux]
$ ./fifo1.sh
+ rm -f foo
+ mkfifo foo
+ exec
+ echo blah
[Terminal 2, Linux]
$ ./fifo2.sh
+ read bar
+ echo blah
blah
On Cygwin, however, Terminal 1 remains blocked, and Terminal 2 is
blocked when it tries to read:
[Terminal 2, Cygwin]
$ ./fifo2.sh
+ read bar
The problem disappears if I remove the line "exec 7>foo" from fifo1.sh.
The problem also disappears if I leave that line in, but change the
last line to "echo blah >&7".
Ken
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple