Skip to content

Instantly share code, notes, and snippets.

@gfldex
Created November 15, 2016 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfldex/a4d6908a2f1072bdcb6e05f88b8f8f82 to your computer and use it in GitHub Desktop.
Save gfldex/a4d6908a2f1072bdcb6e05f88b8f8f82 to your computer and use it in GitHub Desktop.
use v6;
CATCH { default { say .^name; say .Str } }
# say qx{find / -print}.lines;
# if qx{} steps onto malformed utf8: Unable to read from 'find / -print'
# exit 0;
my $find = Proc::Async.new(|<find / -print>);
react {
whenever $find.stdout(:bin) -> $line {
QUIT { when X::AdHoc { say .^name, .Str } }
print $line.decode('utf8-c8');
}
whenever $find.stderr(:bin) -> $line {
QUIT { say .^name }
# put "FAIL: $line"
}
$find.start;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment