[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: weird pipe behaviour!



>>>>> "Hamish" == Hamish Moffatt <hamish@debian.org> writes:

    Hamish> I've noticed some really strange behaviour with pipes. Try
    Hamish> this:

    Hamish> mkfifo wow
    Hamish> cat < wow &
    Hamish> cat < wow &
    Hamish> echo hi there > wow

This is what I get from zsh (similar from bash, too):

[535] [snoopy:bam] /tmp >mkfifo wow
[536] [snoopy:bam] /tmp >cat < wow &
[1] 14084
[537] [snoopy:bam] /tmp >cat < wow &
[2] 14085
[537] [snoopy:bam] /tmp >echo hi there > wow
[538] [snoopy:bam] /tmp >hi there

[1]  - done       cat < wow
[538] [snoopy:bam] /tmp >
[2]  + done       cat < wow
[538] [snoopy:bam] /tmp >

(don't really understand fifos - I thought the 2nd cat command would
still be blocked...)

from tcsh:

[539] [snoopy:bam] /tmp >tcsh
snoopy:/tmp> rm wow
snoopy:/tmp> mkfifo wow
snoopy:/tmp> cat < wow &
[1] 14106
snoopy:/tmp> cat < wow &
[2] 14107
snoopy:/tmp> echo hi there > wow
hi there
[1]    Done                          cat < wow
snoopy:/tmp> echo hi there > wow

process is blocked - why is this so different from zsh/bash???  I
thought the 2nd write command would unblock the 2nd read command...
Now to find out how to unblock it - neither Ctrl+C or Ctrl+Z do
anything, at least with tcsh. Later: reading from the pipe unblocks
both blocked processes:

[2]    Done                          cat < wow
snoopy:/tmp>

>From a text mode console, slink, both with bash and zsh. Perhaps this
is a potato specific bug in tcsh??? I don't think a shell should ever
just exit, unless you manually exit.

What happens if you don't run it inside a window (so you can see any
errors that might occur) or run your shell within another shell?

-- 
Brian May <bam@debian.org>


Reply to: