Skip to content

Instantly share code, notes, and snippets.

@AlexDaniel
Last active February 8, 2020 18:32
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 AlexDaniel/fca7b261d6a4e46290d2fdb7645e5e2a to your computer and use it in GitHub Desktop.
Save AlexDaniel/fca7b261d6a4e46290d2fdb7645e5e2a to your computer and use it in GitHub Desktop.
use v6;
my $filename = 'sandbox/null-program.p6';
my $fh = open $filename, :w;
END { unlink $filename }
$fh.put: 「
$*ERR.say( Q/This goes to standard error/ );
$*OUT.say( Q/This goes to standard output/ );
exit 137;
」;
{
my $proc = run $*EXECUTABLE, $filename;
say "1. Exit is { $proc.exitcode }";
}
{
my $proc = run $*EXECUTABLE, $filename, :out;
$proc.out.slurp-rest( :close );
say "2. Exit is { $proc.exitcode }";
}
{
my $proc = run $*EXECUTABLE, $filename, :err;
$proc.err.slurp-rest( :close );
say "3. Exit is { $proc.exitcode }";
}
{
my $proc = run $*EXECUTABLE, $filename, :out, :err;
$proc.out.slurp-rest( :close );
$proc.err.slurp-rest( :close );
say "4. Exit is { $proc.exitcode }";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment