my $FIFO=undef; mkfifo( $svitok_truby, 0700 ) || die 'Ошиб
 +82;а создания & +#1090;рубы '.$svitok_truby.' : '.$!; local $SIG{CHLD} = "IGNORE"; if( $nomer_vosproizvodyshchego_protsessu=fork ){ $|=1; open( $FIFO, '>', $svitok_truby ) || die 'Не о
 +90;крыть труб&# +1091; '.$svitok_truby.' на запи&# +1089;ь : '.$!; <sniped> print $FIFO 'pause'; <sniped> }else{ exec '/usr/bin/mplayer -slave -input file='.$svitok_truby.' /tmp/1.f +lac'; } close( $FIFO ); unlink $svitok_truby;
Just one question, is there a flush command -- to execute after each writing to pipe?
I did test more and have noticed weird connection between input in parent and pausing of mplayer, though to pipe was sent nothing at all -- parent just does its own work, w/o sending a thing to pipe, for example:
mkfifo( $svitok_truby, 0700 ) || die 'Ошиб
 +82;а создания & +#1090;рубы '.$svitok_truby.' : '.$!; # Управляющk +2;я часть ("род +итель"). if( $nomer_vosproizvodyshchego_protsessu=fork ){ $|=1; use Term::ReadKey; ReadMode 'cbreak'; # Parent while( 1 ){ $knopka=&ReadKey( 0 ); if( $knopka eq '/' ){ system( '/bin/date' ); }elsif( $knopka eq $knopka_vyhodu ){ system( '/bin/echo quit >'.$svitok_truby ); last; } } }else{ ## Child for( $i=0; $i<=$#svitok_na_vosproizvedenie; $i++ ){ system( '/usr/bin/mplayer -slave -input file='.$svitok_truby.' '.$ +svitok_na_vosproizvedenie_kom[$i] ); } } ReadMode 'normal'; unlink $svitok_truby;
So, when i press key / -- parent just outputs date. But many times pressing, once, «mplayer2» will pause playing -- though nothing was sent to pipe! -- And that input-pipe relation i can not understand. Module «Term» does not have influence -- i had the same w/ the «read» function.
Oh! The site terribly corrupts my input!
Thanks for your answers.
In reply to Re^2: To organize pipe right way.
by nikolay
in thread To organize pipe right way.
by nikolay
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |