>  From: Andreas Schwab <[EMAIL PROTECTED]>
>  Subject: Re: mkfifo and tee within a function
>  Sent: 2006-11-28 15:09
>  
>  Nathan Coulter <[EMAIL PROTECTED]> writes:
>  
>  > Could anyone please provide a few pointers on how to accomplish this, and 
> perhaps explain the results from the above examples?
>  
>  A process writing to a pipe that has no reader will receive EPIPE/SIGPIPE
>  and die thereof by default.  So it all depends on timing.
>  

I think that is true for an anonymous pipe, but not for a named pipe.  A 
command which opens a named pipe for writing should block until a reader comes 
online.  In the following example, I get an error with "source', but not with 
"cat".  Why?

$>cmd_print () { mkfifo zout; tee zout & sleep 2; cat zout ; rm zout; }
$>cmd_print <<EOF
> date
> EOF
[1] 5167
date
date
[1]+  Done                    tee zout
$>cmd_print () { mkfifo zout; tee zout & sleep 2; source zout ; rm zout; }
$>cmd_print <<EOF
> date
> EOF
[1] 5174
date
tee: zout: Broken pipe
$>

-- 
Nathan Coulter


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to