[Tutor] os.system

Hans Gubitz gubitz@netcologne.de
Tue, 20 Nov 2001 17:35:13 +0100


On Mon, Nov 19, 2001 at 06:12:53PM -0500, Michael P. Reilly wrote:
> class bild:
>   def __init__(self, host, bild)
>     self.host = host
>     self.bild = bild
>     cmd = 'xv -display %s:0.0 %s' % (host, bild)
>     self.pid = popen2.Popen3(cmd, 0)
> 
>   def kill(self):
>     sts = self.pid.poll()
>     if sts == -1:
>       os.kill(self.pid.pid, 15)
>       sts = self.pid.wait()  # need this to prevent zombies at least
>     return sts
> 
> This might be a little more secure for your needs.
> 
>   -Arcege
> 
> -- 
> +----------------------------------+-----------------------------------+
> | Michael P. Reilly                | arcege@speakeasy.net              |
Your class doesn't work here. self.pid.pid doesn't return the right pid. 
I will read the documentation on Popen3.

Hans
-- 
Hans Gubitz <gubitz@netcologne.de>