[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: KProcess overhaul
From:       Thiago Macieira <thiago () kde ! org>
Date:       2006-04-17 10:41:16
Message-ID: 200604171241.27450.thiago () kde ! org
[Download RAW message or body]


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

[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic