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!

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.

Pedro


On Thu, Oct 17, 2013 at 11:44 AM, Brad King <brad.k...@kitware.com> wrote:

> On 10/17/2013 02:18 PM, Bill Hoffman wrote:
> > On 10/17/2013 1:52 PM, Pedro Navarro wrote:
> >> Ok, I have the patch working and I'm going to send it soon. One
> >> question, is it possible to launch a detached process from within CMake?
> >> If I use EXECUTE_PROCESS to start p4d, CMake waits for it to finish so
> >> -for now- I'm launching the Perforce daemon outside CMake.
> >>
> > It is not possible to do this.  One work around is to put the start of
> > the process in a shell script or bat file that is used to run the ctest
> > script which is basically what you are doing.  :)
>
> If this is restricted to a UNIX-like environment one can use a shell
> script that internally executes a background job, e.g.
>
>  execute_process(COMMAND sh -c "nohup p4d >/dev/null 2>&1 &")
>
> Actually the internal KWSys Process library used to implement the
> execute_process command does know how to create and disown daemon
> processes.  If necessary one could teach execute_process options to
> trigger this behavior.
>
> In either case there is no clear way to terminate the daemon when
> the test is done.
>
> -Brad
>
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to