(QT/kdelib) how to know the end of a command in KTerminalInterface?

182 views Asked by At

I have a KTerminalInterface (from kparts) in my qt/kdelib app, and I run a command within it.

The problem is: how can I know if the program is terminated? I need to know it because at its end I must reset some variable.

Does anyone got a similar problem?!?

2

There are 2 answers

0
Bille On BEST ANSWER

It isn't possible to communicate with the process once launched via TerminalInterface in KDE 4, since KonsolePart (which implements TerminalInterface) no longer has processExited() or receivedData() signals. In KDE 4, KonsolePart is for interactive terminal sessions, not for your app to use.

In KDE 4, use KProcess to spawn an external command from your app, communicate with it, and detect when it terminates. See the QProcess parts of its API.

0
gatoatigrado On

you might be able to use os.waitpid(-1) to wait for child processes (with another thread if you can't have the main one block).