Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created June 17, 2017 11:18
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 zoffixznet/440cf8f7131632aa673b75dbb3a625b3 to your computer and use it in GitHub Desktop.
Save zoffixznet/440cf8f7131632aa673b75dbb3a625b3 to your computer and use it in GitHub Desktop.
use Test;
my $sh1 = run($*EXECUTABLE, '-e', 'say join "\n", lines', :out, :in);
$sh1.in.write-internal: "foobarbaz".encode;
$sh1.in.close;
$sh1.out.close;
my $sh2 = run($*EXECUTABLE, '-e', 'my @l = lines; .say for @l;', :in($sh1.out),
:out );
is $sh2.out.slurp(:close), "foobarbaz\n", 'Can capture stdout and stderr, and chain stdin';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment