LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Piping to multiple processes (which might die)?

[ILUG] Piping to multiple processes (which might die)?

Ronan Cunniffe ronan at cunniffe.net
Wed Jul 31 15:13:25 IST 2002


Quoting Brian Foster <blf at utvinternet.ie>:
>   | I did the following:
>   | 
>  1|   $ mkfifo f1
>  2|   $ lav2yuv capture.avi | yuvdenoise | tee f1 | mpeg2enc blah blah &
>  3|   $ cat f1 | mpeg2enc different blah blah
>   | 
>   | And hey! It works!  Until somebody dies!  Yippe... oh.  [ ... ]
> 
>  ( a winner of the Useless Use of cat(1) Award:  you don't need
>   the `cat f1 |' in the 3rd line, a simple `<f1' will suffice. )
Grrr... I've had that bad habit since MS-DOS 3.2

>  upshot is a POSIX.2 `tee' would probably spit out an error
>  message if one of the `mpeg2enc's dies, but the remaining
>  one would continue to be fed data and hence run until it
>  either completes or dies for reasons of its own.  which is
>  exactly what you want!   so what is happening??

<contrition>
  Oops.
</contrition>

Um, my test was to tee to a fifo I didn't read from... resulting in the other
reader hanging around forever.... not realising that never-opened-for-reading
and opened-and-later-closed might be different.  Sensible behaviour has now been
observed.
 
>  incidently, if your shell and system both support process
>  redirection, you could do the above as a one-liner.  syntax
>  varies depending on the shell, but in bash(1) and ksh(1):
> 
>      lav2yuv capture.avi | yuvdenoise | \
>          tee >(mpeg2enc different blah blah) | mpeg2enc blah blah
mpeg2enc generates stats during the run, so I give each one an xterm.

Thanks,
Ronan





More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell