Re: Close a Running Sub-Process
- From: xhoster@xxxxxxxxx
- Date: 30 Aug 2006 23:05:51 GMT
xhoster@xxxxxxxxx wrote:
"mumebuhi" <mumebuhi@xxxxxxxxx> wrote:
The script will block when it tries to close the filehandle. How do I
force it to close while tail is still running?
You capture the pid of the running process (it is the return value of a
pipe open), and then you kill it just prior to the close.
my $pid=open my $fh, $cmd or die $!;
#....
kill 1,$pid;
close $fh;
Unfortunately, this seems to leave idle processes hanging around
on the remote server. They will go away if the file they are tailing
ever grows enough so that tail -f fills up the pipe buffer, but if that
never happens then they might never get cleaned up. Maybe the safest thing
to do is write a perl emulation of tail which runs on the remote server.
Then you have the termination criteria evaluated at the remove server
rather than the local one.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.
- References:
- Close a Running Sub-Process
- From: mumebuhi
- Re: Close a Running Sub-Process
- From: xhoster
- Close a Running Sub-Process
- Prev by Date: Re: Close a Running Sub-Process
- Next by Date: Simple compiled regexp not working
- Previous by thread: Re: Close a Running Sub-Process
- Next by thread: Simple compiled regexp not working
- Index(es):
Relevant Pages
|
|