c++ fork() & execl() dont wait, detach completely
<p>So I have a simple fork and exec program. It works pretty good but I want to be able to detach the process that is started, I try a fork with no wait:</p>

<pre><code>if((pid = fork()) &lt; 0)
    perror("Error with Fork()");
else if(pid &gt; 0) {
    return "";
}
else {
    if(execl("/bin/bash", "/bin/bash", "-c", cmddo, (char*) 0) &lt; 0) perror("execl()");
    exit(0);
}
</code></pre>

<p>It starts the proc fine but when my main app is closed - so is my forked proc.</p>

<p>How do I keep the forked process running after the main proc (that started it) closes?</p>

<p>Thanks :D</p>
