[PATCH] Allow forced new processes for KUniqueApplication

Robert Knight robertknight at gmail.com
Sun Mar 23 14:55:32 GMT 2008


Hi,

It does fork though.  The difference is that the D-Bus service name
which is registered is the "appname-$PID", instead of just "appname".
The effect is the same as creating a KUniqueApplication with
configUnique set to true in the constructor and the
KDE/MultipleInstances property set to true in the application's config
file.  (See the KUniqueApplication API docs).

Incidentally, right now you cannot --nofork more than one instance of a
program.  Otherwise it fails to register with DBus and bails out with an
error.  

I could add a separate flag to control whether or not forking occurs as
well:

eg.  

StartFlags { 
	ForceNewProcess = 0x1 , 
	DoNotFork = 0x2 
}   

Regards,
Robert.

On Sun, 2008-03-23 at 08:13 +0100, Thiago Macieira wrote:
> Robert Knight wrote:
> >Hello,
> >
> >Konsole is a KUniqueApplication and uses only one process for all
> >instances.  This causes a problem where shells in a newly started
> >Konsole do not inherit their environment from the parent terminal and
> >debug output from the new instance does not appear in the parent
> >terminal.
> >
> >What I would like to do is to force the creation of a new process when
> >Konsole is started from the terminal but share a single process for
> >instances created from a GUI (the start menu, ALT-F2 dialog etc.)
> >
> >Attached is a patch for KUniqueApplication which overloads
> >KUniqueApplication::start() to take a set of flags to control how how
> >the new instance is created, including forcing the creation of a new
> >process if necessary.
> 
> Please call it DontFork, since it would match the --nofork command-line 
> option.
> 





More information about the kde-core-devel mailing list