[wxPython] when will wxKill be ported to the windows version?

when will wxKill be ported to the windows version?
I’m looking for an easy way to Kill an external program that is started by my program. It is started via a checkbox and I would like to kill it when the checkbox is unchecked. I capture the pid and would like to kill it via the pid.

Any idea’s

Grant (da gup)

···

This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.

Ce courriel est confidentiel et protégé. L’expéditeur ne renonce pas aux droits et obligations qui s’y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu’il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courriel par erreur, veuillez m’en aviser immédiatement, par retour de courriel ou par un autre moyen.

==============================================================================

Assuming you're running on a Unix OS:

import os

def run(program, *args):
    pid = os.fork()
    if pid == 0:
        os.execvp(program, (program,) + args)
    else:
        return pid

def kill(pid, signal = 9):
    os.system("kill -%d %d" % (signal, pid))

pid = run("find", "/usr")
kill(pid)

···

On Tue, 25 Jun 2002 13:06:03 -0400 Hallam, Grant wrote:

I'm looking for an easy way to Kill an external program that is started by
my program. It is started via a checkbox and I would like to kill it when
the checkbox is unchecked. I capture the pid and would like to kill it via
the pid.

--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308

> I'm looking for an easy way to Kill an external program that is started by
> my program. It is started via a checkbox and I would like to kill it when
> the checkbox is unchecked. I capture the pid and would like to kill it via
> the pid.

Assuming you're running on a Unix OS:

import os

[...]

def kill(pid, signal = 9):
    os.system("kill -%d %d" % (signal, pid))

Or you could just use os.kill :wink:

···

On Tue, Jun 25, 2002 at 11:15:38AM -0700, Cliff Wells wrote:

On Tue, 25 Jun 2002 13:06:03 -0400 > Hallam, Grant wrote:

>
> > I'm looking for an easy way to Kill an external program that is started

by

> > my program. It is started via a checkbox and I would like to kill it

when

> > the checkbox is unchecked. I capture the pid and would like to kill it

via

> > the pid.
>
> Assuming you're running on a Unix OS:
>
> import os
[...]
> def kill(pid, signal = 9):
> os.system("kill -%d %d" % (signal, pid))

Or you could just use os.kill :wink:

Well... yeah. _If_ you wanted to do it the easy way :wink:

···

On Tue, 25 Jun 2002 14:27:10 -0400 Joshua Judson Rosen wrote:

On Tue, Jun 25, 2002 at 11:15:38AM -0700, Cliff Wells wrote:
> On Tue, 25 Jun 2002 13:06:03 -0400 > > Hallam, Grant wrote:

--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308

One more thing. To avoid having zombie (defunct) processes hanging about, you
have to do an os.wait() on the pid, so here's a revised solution (including
using os.kill :wink: :

import os

def run(program, *args):
    pid = os.fork()
    if pid == 0:
        os.execvp(program, (program,) + args)
    else:
        return pid

pid = run("find", "/usr")
os.kill(pid)
os.waitpid(pid, 0)

Don't know why I don't read my own source (having done this before) before
posting answers...

···

On Tue, 25 Jun 2002 11:28:50 -0700 Cliff Wells wrote:

On Tue, 25 Jun 2002 14:27:10 -0400 > Joshua Judson Rosen wrote:

> On Tue, Jun 25, 2002 at 11:15:38AM -0700, Cliff Wells wrote:
> > On Tue, 25 Jun 2002 13:06:03 -0400 > > > Hallam, Grant wrote:
> >
> > > I'm looking for an easy way to Kill an external program that is started
by
> > > my program. It is started via a checkbox and I would like to kill it
when
> > > the checkbox is unchecked. I capture the pid and would like to kill it
via
> > > the pid.

--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308

And you have to pass the signal to os.kill <blush>:

import os, signal

def run(program, *args):
    pid = os.fork()
    if pid == 0:
        os.execvp(program, (program,) + args)
    else:
        return pid

pid = run("find", "/usr")
os.kill(pid. signal.SIGTERM)
os.waitpid(pid, 0)

···

On Tue, 25 Jun 2002 11:28:50 -0700 Cliff Wells wrote:

On Tue, 25 Jun 2002 14:27:10 -0400 > Joshua Judson Rosen wrote:

> On Tue, Jun 25, 2002 at 11:15:38AM -0700, Cliff Wells wrote:
> > On Tue, 25 Jun 2002 13:06:03 -0400 > > > Hallam, Grant wrote:
> >
> > > I'm looking for an easy way to Kill an external program that is started
by
> > > my program. It is started via a checkbox and I would like to kill it
when
> > > the checkbox is unchecked. I capture the pid and would like to kill it
via
> > > the pid.

--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308

On Tue, 25 Jun 2002 11:36:03 -0700
Cliff Wells blabbered:

os.kill(pid. signal.SIGTERM)

should be

os.kill(pid, signal.SIGTERM)

···

--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308