-
-
Save b2gills/354aed9849d8a0f5fc537882f28f896c to your computer and use it in GitHub Desktop.
Test eof
This file contains 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
#! /usr/bin/env perl6 | |
use v6.d.PREVIEW; | |
my $proc = Proc::Async.new( | |
:w, | |
$*EXECUTABLE, | |
'-e', | |
'loop { last if $*IN.eof; put "Got line " ~ $*IN.get }' | |
); | |
start { | |
await $proc.ready; | |
$proc.put: 'a'; | |
sleep .5; | |
$proc.put: 'b'; | |
sleep .5; | |
$proc.put: 'c'; | |
sleep .5; | |
$proc.close-stdin; | |
} | |
start react { | |
whenever $proc.stdout.lines { | |
say ':', $_ | |
} | |
whenever $proc.stderr {} | |
} | |
say 'exitcode ',$proc.start.result.exitcode; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment