Created
May 4, 2018 14:07
Star
You must be signed in to star a gist
Trace Failure
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
| # The script below runs fine with out trace, but with trace | |
| # I get the following error: | |
| # | |
| # Type Block does not support associative indexing. | |
| # in block <unit> at traceTest.p6 line 16 | |
| use trace; | |
| sub proc(*@cmd) { | |
| # Takes a terminal command and starts a new async process | |
| # Returns the process, channel with stdout/stderr, and promise | |
| my $proc = Proc::Async.new(|@cmd, :w); | |
| my $out = Channel.new; | |
| $proc.Supply.tap( -> $str { $out.send($str) } ); | |
| my $promise = $proc.start; | |
| return {proc => $proc, out => $out, prom => $promise}; | |
| } | |
| my $test = proc('echo', 'hello world'); | |
| my $output; | |
| until $output ~~ "hello world\n" { | |
| $output = $test{'out'}.poll; | |
| } | |
| say $output; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment