Opening a FIFO end is supposed to block until the other end is opened, too.

So we need a little work-around to open both ends in the shell process to
avoid blocking. Apparently Haiku's FIFO implementation isn't quite conforming
yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40100 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2011-01-04 01:39:30 +00:00
parent 6186bb4464
commit 3292bde924

View File

@ -84,10 +84,14 @@ elif [ $isImage ]; then
# Open the FIFOs such that they are ready for the fsShellCommand. This
# also makes sure that they remain open until this script exits. When we
# exit while the FS shell is still running and waiting for commands,
# closing of our file descriptors will break the pipes and the FS shell
# closing of our file descriptors will break the FIFOs and the FS shell
# will exit, too.
exec 3<$fromFSShellFifo 4>$toFSShellFifo 5<$toFSShellFifo \
6>$fromFSShellFifo
# Note: A bit of trickery is needed since opening one end blocks until
# someone opens the other end.
sleep 3<$fromFSShellFifo 1 &
exec 6>$fromFSShellFifo 3<$fromFSShellFifo
sleep 5<$toFSShellFifo 1 &
exec 4>$toFSShellFifo 5<$toFSShellFifo
# Remove the FIFO files again -- we have the open FDs, so they can
# still be used and this makes sure they won't hang around any further.