Reputation: 11168
This program catches all of the standard error from another program, but it sometimes gives me a partial line:
#!/bin/env perl6
my $proc = Proc::Async.new('./print_to_stderr');
$proc.stderr.tap( -> $str {
for $str.lines() {
put "Captured ERR: $_";
}
});
my $promise = $proc.start;
await $promise;
Using ./print_to_stderr
:
#!/bin/env perl6
for ^10 {
$*ERR.put: "($_): Howdee";
}
Just now, I got the following output:
Captured ERR: (0): Howdee
Captured ERR: (1): Howdee
...
Captured ERR: (6): Howdee
Captured ERR: (7): Howde
Captured ERR: e
Captured ERR: (8): Howdee
As you see, for item 7
, the standard error was broken up between two different tap
s. But I'd like it to wait and give me a whole line.
Update: This was reproducible for me using Rakudo Star 2017.04
, but this isn't an issue in Rakudo Star 2017.07
as pointed out by Elizabeth Mattijsen below.
Upvotes: 2
Views: 127
Reputation: 26969
Which version of Rakudo Perl 6 are you using? I cannot reproduce this issue. In any case, Supply.lines
should not give you incomplete lines, ever. So if this is happening on the most recent version of Rakudo Perl 6, this should be reported as a bug.
Upvotes: 3