Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: exec with cleanup

by roju (Friar)
on Jun 07, 2004 at 14:14 UTC ( #361984=note: print w/replies, xml ) Need Help??


in reply to exec with cleanup

How about this?

END{ $ENV{"PARENT"} = $$; if ($pid = fork()) { //do whatever your script does to end else { wait({$ENV{"PARENT"}}); exec (foo); } }

Although considering how fork works, you could just do

END { if ($pid = fork()) { wait($pid); exec(foo); } else { //finish your process off } }

Now, either way, the process that wait's is still going to have a copy of all the descriptors and stuff, but that shouldn't be a huge problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://361984]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2023-12-11 12:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (41 votes). Check out past polls.

    Notices?