5
I've read about fork and from what I understand, the process is cloned but which process? The script itself or the process that launched the script?
For example:
I'm running rTorrent on my machine and when a torrent completes, I have a script run against it. This script fetches data from the web so it takes a few seconds to complete. During this time, my rtorrent process is frozen. So I made the script fork using the following
my $pid = fork();
if ($pid) == 0) { blah blah blah; exit 0; }
If I run this script from the CLI, it comes back to the shell within a second while it runs in the background, exactly as I intended. However, when I run it from rTorrent, it seems to be even slower than before. So what exactly was forked? Did the rtorrent process clone itself and my script ran in that, or did my script clone itself? I hope this makes sense.
Your probably better off asking on Stackoverflow. – Unfundednut – 2010-03-07T00:59:49.960
1rTorrent may have setup pipes for its child's std{in,out,err}. If so, you might need to close them (or close and repoen the output descriptors to some log file, if that is important) before rTorrent will continue. – Chris Johnsen – 2010-03-07T04:09:45.737