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.
In reply to Re: exec with cleanup
by roju
in thread exec with cleanup
by bart
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |