Created
August 26, 2016 05:56
-
-
Save awwaiid/7f1c6819ec00a0cc8f8bdb3de14e2ab3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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