ExtTerminalInterface + KProcess extension for KDE 3.4/4.0
Peter Rockai (mornfall)
mornfall at danill.sk
Mon Jun 7 17:57:19 BST 2004
I have a program where i want to use embedded konsolePart. However, i have run
into severe problems with the TerminalInterface, implemented by this part.
What i need is to be able to get at the KProcess object the konsolePart
creates to run the program started by startProgram, before it is run. So i
need to add 2 new virtual methods to the interface, which i believe is
required to remain binary compatible with 3.2 version. What i want to do is
create new ExtTerminalInterface, subclassing the TerminalInterface and adding
two functions to it:
KProcess *setupProcess (const QString &program, const QStrList &args)
void startProcess (void).
These would act same as startProgram from TerminalInterface, but in 2 stages
and thus allow access to the KProcess object. I think the process object
should not be destroyed by the part, but left for the caller to handle.
It should be trivial to implement startProgram in terms of those then.
Another part of the same problem lies in the fact, that i need to be able to
do some custom post-fork initialization for KProcess. My proposed solution
would be to add a signal to KProcess, that would be emitted right before the
execvp call in KProcess::start (). This would allow to do the required
initialization in the child process, by connecting to the signal.
For 3.3, I have the option to create a wrapper around the executable ran, but
it is very unwieldy, as i need some of the data present in my program in the
initialization, so i will have to pass them through a pipe or something like
that... If more people think these extensions are feasible enough to be part
of 3.3, i can pay the price in bugfixes though.
Anyway, i would like to hear some opinions on the proposed solutions.
Thank you very much, yours,
More information about the kde-core-devel