perl hangs when piping

From: funtoosh (a_gilotra_at_yahoo.com)
Date: 02/27/04


Date: 27 Feb 2004 08:55:44 -0800

Hi

am using Perl 5.8.0 on RH-9 box (kernel 2.4.20.x)

I have this command

/home/me/myProgram |perl myPscript.pl >/tmp/log-file &
which runs fine when run from command prompt.
Purpose of myPscript.pl is to detect EOF condition and exit on it.
So, when /home/me/myProgram is killed, myPscript.pl detects it and
exits gracefully.

But problem starts when
I run the above command as :

rsh anotherBox "/home/me/myOtherProgram |perl myPscript.pl
>/tmp/log-file" &

( Here myOtherProgram is a threaded (POSIX) program and it creates 2
threads when running )

then I logon to anotherBox and manually kill myProgram's main thread (
When main dies, child threads also dies ) so that EOF is send to my
perl script.

But I noticed that the moment I kill main thread, perl starts taking
99.9 of cpu
and doesnt die. It is looking for some resource but what ?

any clue ?

perl script :
-----------------------------------------
while (<>) {
push @buffer;
}
print @buffer;
-------------------------------------------------



Relevant Pages

  • perl hangs when piping
    ... which runs fine when run from command prompt. ... Purpose of myPscript.pl is to detect EOF condition and exit on it. ... perl script. ...
    (comp.os.linux.misc)
  • query status of STDIN
    ... I have a perl script that most of the time is ... want to look at the exit status of the "upstream" command, that is, some_command. ... If that command has a nonzero exit status, I deem the input as incomplete. ...
    (comp.lang.perl.misc)
  • Re: dd command & reading in background
    ... ^ D,"UnixReview: Shell Corner: The dspl Korn Shell ... user input timeout, do a search on C.U.S. for the ... # 0<c<127 - job exited with this exit code ...
    (comp.unix.shell)
  • Re: Most dependable way to run system commands
    ... Eventually I'd like to bring the execution of a few system commands ... specific execution issue (it dealt more with executing Perl code)). ... Unix and many similar systems, the exit status is an integer, with 0 ... variable after running a command via system or backticks. ...
    (perl.beginners)
  • Re: very slow cursor in CMD window w/Text editor?
    ... REM MS-DOS-based application, Windows runs COMMAND.COM. ... To run CMD.EXE, the Windows command prompt, ... The exit command is an internal command part of command.com or cmd.exe. ...
    (microsoft.public.windowsxp.general)