Re: name pipe problem, quick question

From: Lew Pitcher (
Date: 06/11/04

Date: Fri, 11 Jun 2004 15:06:44 -0400

Hash: SHA1

187 wrote:

> "Richard Tobin" <> wrote in message
> news:cacln2$7j6$
>>In article <>,
>>187 <> wrote:
>>>>>rm $b/cmd-1
>>>>>mkfifo $b/cmd-1
>>>>>rm $b/res-1
>>>>>mkfifo $b/res-1
>>>> [...]
>>>>>echo "" > $b/cmd-1&
>>>>your script stops here, waiting for something to open $b/cmd-1 for
>>>How can I fix the problem? Any suggestions?
>>Don't write to the named pipes until the program is listening on them.
> I'm not entirely sure what I'm doing (I've never worked with named pipes
> before), could you please elaborate a little? What do you mean exactly?

Unless the programs handle named pipes with special settings
(O_NONBLOCK, IIRC), you get blocking behaviour by default.

A named pipe can have multiple writers, but only one reader. Any process
that opens the pipe for writing blocks until the pipe has also been
opened for reading. Any process that opens the pipe for reading blocks
on the first read until the pipe has been opened for writing.

The only way around this is to open the pipe in non-blocking mode, and
you can't do this in a script.

- --

Lew Pitcher, IT Consultant, Enterprise Application Architecture
Enterprise Technology Solutions, TD Bank Financial Group

(Opinions expressed here are my own, not my employer's)
Version: GnuPG v1.2.4 (MingW32)