<div dir="ltr"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">I experimented with nohup but from inside a shell script that was being executed from execute_process, but that didn't work. I'll give that a try, thanks!</div>
<div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">There happens to be a way to cleanly shutdown perforce, executing "p4 admin stop", so this could mean that we can start p4d if it's present and on Unix and exit and remote the database when the test finishes, which would be the preferred approach.</div>
<div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Pedro</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Oct 17, 2013 at 11:44 AM, Brad King <span dir="ltr"><<a href="mailto:brad.king@kitware.com" target="_blank">brad.king@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 10/17/2013 02:18 PM, Bill Hoffman wrote:<br>
> On 10/17/2013 1:52 PM, Pedro Navarro wrote:<br>
>> Ok, I have the patch working and I'm going to send it soon. One<br>
>> question, is it possible to launch a detached process from within CMake?<br>
>> If I use EXECUTE_PROCESS to start p4d, CMake waits for it to finish so<br>
>> -for now- I'm launching the Perforce daemon outside CMake.<br>
>><br>
</div><div class="im">> It is not possible to do this.  One work around is to put the start of<br>
> the process in a shell script or bat file that is used to run the ctest<br>
> script which is basically what you are doing.  :)<br>
<br>
</div>If this is restricted to a UNIX-like environment one can use a shell<br>
script that internally executes a background job, e.g.<br>
<br>
 execute_process(COMMAND sh -c "nohup p4d >/dev/null 2>&1 &")<br>
<br>
Actually the internal KWSys Process library used to implement the<br>
execute_process command does know how to create and disown daemon<br>
processes.  If necessary one could teach execute_process options to<br>
trigger this behavior.<br>
<br>
In either case there is no clear way to terminate the daemon when<br>
the test is done.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Brad<br>
</font></span></blockquote></div><br></div>