in reply to exec with cleanup

here's a possible mechanism. At least on windows when used in this way the system() call won't block, it'll launch the command and the parent script continues on. The script returns immediately but if you watch your task manager the spawned perl process continues to run for 60 seconds.

This would seem an undocumented feature - I just glossed over perldoc for system & exec, and I don't see any mention of this behavior. But if the shoe fits .....

my $cmd = 'perl -e "sleep(60)"'; system(1, $cmd); print "Done - but my subprocess is still running!\n";

Replies are listed 'Best First'.
Re^2: exec with cleanup
by halley (Prior) on Jun 08, 2004 at 12:53 UTC
    I would rather use a documented method over an undocumented one. Know your shell.
    system("start /b $cmd");

    --
    [ e d @ h a l l e y . c c ]