Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, March 2008
QProcess: detach after starting ?


Message 1 in thread

I would like to start a QProcess, have it write some data
back to its spawner, then have it detach/daemonize/whatever.

Is this possible in a cross-platform way using QProcess
(or anything else in the Qt API) ? I can only see the
startDetached() method, which doesn't do what I want.

-- 
 [ signature omitted ] 

Message 2 in thread

Stephen Collyer wrote:
>I would like to start a QProcess, have it write some data
>back to its spawner, then have it detach/daemonize/whatever.
>
>Is this possible in a cross-platform way using QProcess
>(or anything else in the Qt API) ? I can only see the
>startDetached() method, which doesn't do what I want.

No. The only way to have a detached process is to start it detached.

QProcess does not support either forgetting about the child process 
(without killing it). In any case, if you did not start it detached, then 
quitting your application will most likely kill the child process 
anyways.

-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: This is a digitally signed message part.


Message 3 in thread

Assuming you are writing the code to the spawned process, you'd have it do the daemonize after it's written whatever data is needed back to the spawner.  The daemonizing part is it's responsibility, in this case.
 
Darin Broady
dbroady1@xxxxxxxxx

----- Original Message ----
From: Thiago Macieira <thiago.macieira@xxxxxxxxxxxxx>
To: qt-interest@xxxxxxxxxxxxx
Sent: Tuesday, March 4, 2008 3:58:41 PM
Subject: Re: QProcess: detach after starting ?

Stephen Collyer wrote:
>I would like to start a QProcess, have it write some data
>back to its spawner, then have it detach/daemonize/whatever.
>
>Is this possible in a cross-platform way using QProcess
>(or anything else in the Qt API) ? I can only see the
>startDetached() method, which doesn't do what I want.

No. The only way to have a detached process is to start it detached.

QProcess does not support either forgetting about the child process 
(without killing it). In any case, if you did not start it detached, then 
quitting your application will most likely kill the child process 
anyways.

-- 
 [ signature omitted ]