aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatias Linares <matias.linares@comprandoengrupo.net>2020-08-18 11:10:21 -0300
committerMatias Linares <matias.linares@comprandoengrupo.net>2020-08-18 11:10:21 -0300
commit6c4d6415b54b0ddba3c5f95c4a39c8d39c99cf10 (patch)
tree5394c05ee612656eb2816b7aa1c4eb1ea3f25e26
parente335e7d99c43a388842a63d24c356c401d19b2ae (diff)
downloadApp-RunForPid-master.tar.gz
Add kill commandHEADmaster
-rw-r--r--lib/App/RunForPid.pm66
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/App/RunForPid.pm6 b/lib/App/RunForPid.pm6
index a82e530..d1362d8 100644
--- a/lib/App/RunForPid.pm6
+++ b/lib/App/RunForPid.pm6
@@ -47,7 +47,7 @@ sub list-file-descriptors($pid) {
#| Find a pid for a window
multi sub MAIN() is export(:main) {
my $ppid = get-pid;
- my @actions = <gdb fd stdout stderr stdout&stderr>;
+ my @actions = <kill gdb fd stdout stderr stdout&stderr>;
say "Found pid from a wm: $ppid";
my @process = parse-process-tree($ppid);
@@ -67,6 +67,10 @@ multi sub MAIN() is export(:main) {
my $fd = choose(list-file-descriptors($pid)) or exit;
run 'tail', '-f', "$fd";
}
+ when 'kill' {
+ my $signal = choose(Signal::.keys) or exit;
+ run 'kill', "-{$signal}", $pid;
+ }
when 'stdout'|'stderr'|'stdout&stderr' {
my $has-stdout = $option.index('stdout').defined;
my $has-stderr = $option.index('stderr').defined;