Skip to content

Instantly share code, notes, and snippets.

@awwaiid awwaiid/killme.pl6
Created Aug 26, 2016

Embed
What would you like to do?
# signal(SIGINT).tap: {
# note "Took { now - INIT now } seconds. $*THREAD";
# }
my $interrupt = signal(SIGINT);
$interrupt.tap: -> $v {
note "[got interrupt $v]";
}
my $interrupt_text = $interrupt.map: -> $v {
# note "Took { now - INIT now } seconds. $*THREAD";
note "Got SIGINT";
# "SIGINT\n";
$v
}
my $input = $*IN.Supply(size => 1);
# my $input = $*IN.Supply;
my $merged_input = $input.merge($interrupt_text);
# my $merged_input = $interrupt_text.merge($input);
# loop {
react {
whenever $interrupt -> $txt {
# whenever $merged_input -> $txt {
# whenever $interrupt_text.lines -> $txt {
say "interrupt: [$txt]";
# say "interrupt: $interrupt";
# exit if $txt ~~ /SIGINT/;
}
whenever $input -> $txt {
# whenever $merged_input -> $txt {
# whenever $interrupt_text.lines -> $txt {
say "input: [$txt]";
# say "interrupt: $interrupt";
# exit if $txt ~~ /SIGINT/;
}
}
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.