Fwd: kprocess - close all open files in the child

Lubos Lunak l.lunak at suse.cz
Thu Dec 19 10:43:52 GMT 2002


On Thursday 19 of December 2002 11:30, Malte Starostik wrote:
> On Wednesday 18 December 2002 23:53, Carsten Pfeiffer wrote:
> > ----------  Forwarded Message  ----------
> >
> > Subject: kprocess - close all open files in the child
> > Date: Wednesday 18 December 2002 09:17
> > From: Klaus-Dieter Krannich <kd at Math.TU-Cottbus.DE>
> > To: kde-devel at kde.org
> >
> > Hi all,
> >
> > Sometimes it is necessary to have additonal (beside stdin/stdout/stderr)
> > communication channels between the caller and the child. In traditional
> > GUI programming this is often done by opening a pipe/socketpair in the
> > caller and passing a filedescriptor via commandline args to the child.
> > The recently added 'close all open files in the child after the fork'
> > feature in kprocess makes such an approach impossible. It would be
> > really nice, if this behaviour was the default, but could be turned off
> > by an appropriate flag at construction time.
>
> IMHO it should also be possible to have a finer control, like the
> possibility to specify a list of fds that should be excempt from closing.

 I wonder why one needs more than stdin/stdout with KProcess.

> Also it's a bad that stdin/out/err are closed because this completely
> disables one to see debug output from an app started via kprocess :-(

 Their not closed, they're only redirected to /dev/null in case they're not 
included in the Communication flag to start(). I did this, I don't remember 
exxactly the details, but I think KProcess started apps from apps running in 
Konsole were getting stop signals without it.
http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdelibs/kdecore/kprocess.cpp#rev1.68

-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak at suse.cz , l.lunak at kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/





More information about the kde-core-devel mailing list