CRAP!


#!/usr/bin/perl

use warnings;
use strict;


$SIG{ALRM} = sub { die "timeout\n" };

eval {
    alarm(10);
        my $oscmd="echo \"hello\"; sleep 30000; echo \"world\";";
        `$oscmd`;
    alarm(0);
};

print "\ps -ef\n";




Run this script, it will time out after 10 seconds
then type ps -ef and it'll show the sleep 30000 in the background.

crap, crap, crap.




>>>>>> "GL" == Greg London <Greg> writes:
>
>   GL> I have been assuming that the 'correct' behavior of perl is that
>   GL> when perl calls die while it is running a command via bacticks
>   GL> that perl kills whatever was run by the backtick command.
>
>   GL> is that a correct assumption?
>
> not that i know. perl doesn't track child processes. that is done by the
> user code and the OS. and the OS never kills a process, it can only let
> them be killed and then reaped by some other process. if a parent dies
> and its child later exits, that will get reaped by the process 0 (or id
> 1?) usually called init. it is the parent of all processes (first
> process after boot) and it will reap any child it sees. a zombie process
> happens when a child die and its parent is still not dead but hasn't
> reaped the child.
>
> use the open pipe idea for full control over the child, its output and
> reaping it.
>
> uri
>
> --
> Uri Guttman  --  uri AT perlhunter DOT com  ---  http://www.perlhunter.com
> --
> ------------  Perl Developer Recruiting and Placement Services
> -------------
> -----  Perl Code Review, Architecture, Development, Training, Support
> -------
>


-- 



_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to