Subject: | killall on cygwin with fname |
Attached patch uses killall fname if cmndline is not defined (cygwin)
2005-09-29 22:29:40 rurban@cpan.org
* Killall.pm (killall): killall on cygwin with fname
--- Proc-ProcessTable-0.40/Killall.pm.orig 2003-05-19 16:34:55.000000000 +0000
+++ Proc-ProcessTable-0.40/Killall.pm 2005-09-29 20:28:16.338875000 +0000
@@ -39,7 +39,7 @@
}
}
-# usage: killall(singal, pattern)
+# usage: killall(signal, pattern)
# return: number of procs killed
sub killall {
croak("Usage: killall(signal, pattern)") unless @_==2;
@@ -52,7 +52,8 @@
my $t = new Proc::ProcessTable;
my $BANG = undef;
foreach my $p (@{$t->table}) {
- if ($p->cmndline =~ /$pat/) {
+ my $cmndline = $p->{cmndline} || $p->{fname};
+ if ($cmndline =~ /$pat/) {
next unless $p->pid != $$ || $self;
if (kill $signal, $p->pid) {
$nkilled++;