|more useful options|
Re^2: Taking control back once Interactive script completesby afoken (Canon)
|on Feb 27, 2020 at 20:00 UTC||Need Help??|
No need to fork and no need to exec. system will do nicely.
Behind the scenes, system() combines fork() and exec() with the missing part of the story: wait resp. waitpid waiting for the child process in the parent process. Or, at least it does so on Unix-like systems. What happens on the children of CP/M (DOS, Windows, OS/2) is a different story ...
But on Unix and friends, all that's really missing is wait():
To make that a little more robust, check if fork() returns undef. It may happen from time to time, RTFM. Also, you may want to keep the PID of the child process in the parent process and explicitly wait for that process to return:
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)