Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: How do I kill a process tree in Windows

by DrWhy (Chaplain)
on Aug 18, 2005 at 20:21 UTC ( [id://484951]=note: print w/replies, xml ) Need Help??


in reply to Re: How do I kill a process tree in Windows
in thread How do I kill a process tree in Windows

So it sounds like you are saying there is no way to do it inside perl; I'll have to go to an external program. I didn't find anything named kill(\.exe)? on my XP box. A little research indicates that this was a tool that came with WIn2k, but not more recent OSs. I did find someone who had taken the code for that kill and updated to work with XP and to handle process trees. That's here.

I'm still kind of hoping there's a good Perl solution out there so I don't have to be starting up external processes in a SIGINT handler. I took a second look at Proc::Killfam just in case it might work under Windows even if it isn't available via ppm. There seems to be some Cygwin compatibility in Proc::ProcessTable (which Proc::Killfam uses to figure out what processes need to be killed), but I don't know if that translates into Windows compatibility for P::K. I'm thinking not.

--DrWhy

"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."

  • Comment on Re^2: How do I kill a process tree in Windows

Replies are listed 'Best First'.
Re^3: How do I kill a process tree in Windows
by Anonymous Monk on Aug 18, 2005 at 21:10 UTC
    Unfortunately I don't know the answer to the Perl topic, however the builtin utility you want on XP is called "taskkill". Passing it the /T parameter is a treekill.
Re^3: How do I kill a process tree in Windows
by ZlR (Chaplain) on Aug 19, 2005 at 15:36 UTC
    Hi,

    If you spawn the processes yourself from within a perl script you should use Win32::Job . This will give you job control and thus the ability to kill a group of process.

    As i understand it, this is the way to control processes in Windows, that is killing a processes and all itīs sons.

    I find dealing with PID and PPIDS is kind of not adapted since PIDs numbers are recycled fastly and you could kill something else !

    In "real" windows programing there may be something like a "process handle" that you get when you create a process and that allow fine control, but within Perl Win32::Job seems the way to go ...

    ZlR.

      This looks great, except the processes I'm trying to kill are started from within another module (Test::Harness). In order to use this I would have to modify Test::Harness, which is just not going to happen... I'll look into taskkill mentioned by the anonymous monk above.

      --DrWhy

      "If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."

Re^3: How do I kill a process tree in Windows
by Eyck (Priest) on Aug 20, 2005 at 07:17 UTC
    It's called a RESOURCE KIT, and you get it on CD with servers(usually), and can download it from microsoft Resource Kit

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://484951]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-18 22:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found