blob: 9a562761d046c3c155d105d154cd4d1e355b5e2e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package thou_shalt_not_kill;
require Exporter;
@ISA = 'Exporter';
@EXPORT_OK = 'kill';
use subs 'kill';
use Carp qw(cluck);
sub import {
my $pkg = shift;
$pkg->export('CORE::GLOBAL', 'kill', @_);
}
sub kill {
return CORE::kill(@_) unless $_[0];
cluck "kill(@_)";
print "\e[1;31m" if -t STDOUT;
system "pstree -c $_" foreach @_[1..$#_];
print "\e[0;39m" if -t STDOUT;
print STDERR 'Kill [y/n] ? ';
my $answer=<STDIN>;
return CORE::kill(@_) if $answer =~ /y/i or $answer eq "\n";
1;
}
1;
|