Re: Killing a process on a win32 box
Jan, wuuau, :-))) exalent article. Thanx a lot. Am 12 Aug 2003 um 12:29 hat Jan Dubois geschrieben: On Tue, 12 Aug 2003 14:48:37 -0400, Jean-Sebastien Guay [EMAIL PROTECTED] wrote: He meant the perl function kill. it should work on Win32 as well. Note that Perl 5.6 will always send a 'KILL' signal, i.e. kill 9, $pid; or kill 'KILL', $pid; regardless what signal you specify. Perl 5.8 has some support for the 'INT' signal on Windows, but unfortunately you cannot send 'INT' (Ctrl-C) to process groups but only single processes. Perl 5.8 started to always create new processes as process groups, so kill 2, $pid; or kill 'INT', $pid; will not work if the process has been created by Perl itself. The process group creation is necessary because Perl often starts child processes via cmd.exe. If it wouldn't mark them as a process group, the 'KILL' signal would only terminate the cmd.exe process but not the _real_ child process. In Perl 5.8.1 it will be possible to send a 'BREAK' (Ctrl-Break) signal to other processes, and that one does indeed work with process groups as well. That will allow you to intercept the signal in the child process and do your cleanup before terminating: $SIG{BREAK} = sub { # shut down exit(1); } In summary: * kill() in Perl 5.6.x on Windows maps all signals to 'KILL'. * kill() in Perl 5.8.0 on Windows maps all signals except 'INT' to 'KILL'. * kill() in Perl 5.8.1 on Windows will map all signals except 'INT', 'BREAK' and 'TERM' to 'KILL'. It will also map 'TERM' to 'BREAK'. Cheers, -Jan ___ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Kris Wolff Application Developer dietzk. Interactive OHG Am Kirchplatz 41-43 D-65779 Kelkheim Fon +49 (0) 6195 72 42- 15 Fax +49 (0) 6195 72 42- 29 [EMAIL PROTECTED] http://www.dietzk.de ___ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Killing a process on a win32 box
Title: RE: Killing a process on a win32 box I dont believe that kill is native to XP. It does have a taskkill command built in though that you can either use the service name or PID for. Thanks, Rick Richard Grakowsky Systems Specialist, Monroe Community College [EMAIL PROTECTED] Office: 585.292.3236 / Fax: 585.427.2749 Progress occurs when we are no longer willing to accept the consequences of inaction. -Original Message- From: Farrington, Ryan [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 1:34 PM To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Subject: RE: Killing a process on a win32 box In theory you can use kill($pid) -Original Message- From: Kris Wolff [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 12, 2003 12:07 PM To: [EMAIL PROTECTED] Subject: Killing a process on a win32 box Hi all, does anybody know, how can i kill a process by its ID on a win2000 or xp box ? Thanx in advanced. Kris Wolff Application Developer dietzk. Interactive OHG Am Kirchplatz 41-43 D-65779 Kelkheim Fon +49 (0) 6195 72 42- 15 Fax +49 (0) 6195 72 42- 29 [EMAIL PROTECTED] http://www.dietzk.de ___ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Killing a process on a win32 box
Title: RE: Killing a process on a win32 box BTW... Here is a good tutorial for that kind of thing http://gsu.linux.org.tr/oreilly/perl/sysadmin/ch04_02.htm Thanks OREILLY -Original Message- From: Kris Wolff [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 12, 2003 12:07 PM To: [EMAIL PROTECTED] Subject: Killing a process on a win32 box Hi all, does anybody know, how can i kill a process by its ID on a win2000 or xp box ? Thanx in advanced. Kris Wolff Application Developer dietzk. Interactive OHG Am Kirchplatz 41-43 D-65779 Kelkheim Fon +49 (0) 6195 72 42- 15 Fax +49 (0) 6195 72 42- 29 [EMAIL PROTECTED] http://www.dietzk.de ___ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs