kcrash, fork, and stdout/stderr

David Faure faure at kde.org
Tue Dec 5 22:14:17 UTC 2017


On mardi 5 décembre 2017 16:46:50 CET Thiago Macieira wrote:
> On Tuesday, 5 December 2017 04:12:30 PST David Faure wrote:
> > I see. But how should one implement a crash handler that autorestarts an
> > app, then, in a "standalone application" use case, i.e. no kdeinit or
> > other
> > daemon running in the background?
> 
> Wait, why are you forking in the first place?
> 
> Just exec the process again. It will replace the current process without
> closing the pipes. The parent won't notice a thing.

Interesting idea. It might work, except that what KCrash currently does
is both restart the app and attach drkonqi to the crashed app (or dump core, 
if drkonqi is disabled), so that users/developers know a crash happened.
Doing just execve() wouldn't allow that.

I'm tempted to just not touch it further.

> Of course, that may be a problem: the parent may see the output from the
> child process again.

It would probably not matter for GUI apps, and the unittest could be adjusted.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5





More information about the Kde-frameworks-devel mailing list