Dear visitor, welcome to KDE-Forum.org.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
kstart child PID
Hi .
I am writing an editor for Linux for the POV-RAY raytracer (with wxpython GUI).
When the user clicks on render I use 'kstart --ontop povray ...' to launch the render on top. The problem is that I need to know the PID of povray to read the output.
I get the PID of kstart ( that dies when povray is started ), but I do not get the child PID.
Does anyone have an idea ?
Thanks
fabien
remove _nospam_ to answer
Maybe running a script and having it write the PID to some temporary file or a pipe.
Cheers,
_
Qt/KDE Developer
Debian User
Yes but how do you get the PID number of the app launched by kstart ?
fabien
remove _nospam_ to answer
When writing the PID of the real program into a file inside the script, the PID of the script doesn't matter, does it?
Cheers,
_
Qt/KDE Developer
Debian User
with the python script below :
f=popen2.Popen4('kstart --ontop povray +itest.pov',1)
az=f.pid
az returns the PID number of kstart, not the PID NUMBER of povray
whereas with
f=popen2.Popen4('povray +itest.pov',1)
az=f.pid
az returns the PID number of povray.
I need to know the PID number to check whether the render is still running and to read the output stream.
Thanks
fabien
remove _nospam_ to answer
So are you ignoring my initial suggestion or did I just not get through that you ought to start a script instead of povray and have the script write the PID into a file or PIPE?
Cheers,
_
Qt/KDE Developer
Debian User
Sorry, but I do not understand ( back from work, dumbness overwhelms me)...
What do you suggest ?
Sure, I can use a script that writes the child PID into a pipe, but I just do not know how to retrieve it.
with this command...
f=popen2.Popen4('kstart --ontop povray +itest.pov',1)
kstart spawns a child, but I cannot get the PID of its child.
If you have even a tiny script, please enclose it.
Thanks for enduring this.
Fabien
fabien
remove _nospam_ to answer
Originally posted by fabienhenon
with this command...
f=popen2.Popen4('kstart --ontop povray +itest.pov',1)
f.pid ?
Originally posted by fabienhenon
What do you suggest ?
Sure, I can use a script that writes the child PID into a pipe, but I just do not know how to retrieve it.
By reading the file/pipe?
For example in bash you can do this
|
Source code
|
1
2
|
povray $@ &
echo $! > $(kdeconfig --path tmp)/povray.pid
|
Then read povray.pid from the KDE tmp location
I guess an advanced script language like Python can do this as well.
Cheers,
_
Qt/KDE Developer
Debian User
Hi,
With the script below :
povray $@ &
echo $! > $(kdeconfig --path tmp)/povray.pid
I can get povray pid
With the script below :
kstart povray $@ &
echo $! > $(kdeconfig --path tmp)/povray.pid
I can get kstart pid, not povray pid (and that is what I want)
Cheers,
Fabien
fabien
remove _nospam_ to answer
Originally posted by fabienhenon
With the script below :
kstart povray $@ &
echo $! > $(kdeconfig --path tmp)/povray.pid
I can get kstart pid, not povray pid (and that is what I want)
Obviously, as you
again use povray as the command for kstart instead of the script.
Do you think creating a script and putting it somewhere help when you don't change the command you are calling?
Cheers,
_
Qt/KDE Developer
Debian User