KProcess overhaul

Thiago Macieira thiago at kde.org
Mon Apr 17 11:41:16 BST 2006


Simon Perreault wrote:
>On Saturday 15 April 2006 16:33, Ralf Habacker wrote:
>> >>> for example to detect child process termination,
>> >>
>> >> not really.
>>
>> You mean closing of the pipe indicate process termination.
>
>No, the parent receives a SIGCHLD when a child dies. The pipe may be
> closed by the child before its death if it wishes so.

I'm not sure if everyone is discussing the same thing here. (and I'm not 
sure of myself either).

QProcess creates a pipe with FD_CLOEXEC. That means the pipe is closed 
when the program is executed. However, if exec* failed, the child process 
writes something to the pipe and then exits too, closing the pipe.

That's the only way the parent process can tell if the execution succeeded 
or not: by checking if the pipe was written to.

-- 
Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
  thiago.macieira (AT) trolltech.com     Trolltech AS
    GPG: 0x6EF45358                   |  Sandakerveien 116,
    E067 918B B660 DBD1 105C          |  NO-0402
    966C 33F5 F005 6EF4 5358          |  Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060417/8352b57b/attachment.sig>


More information about the kde-core-devel mailing list