Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Test: Make sure we close all handles
Some VMs (ex. Parrot) don't finalize objects like file handles during
program shutdown, so there may remain data unflushed from userspace.
  • Loading branch information
hoelzro committed Aug 17, 2014
1 parent 678f286 commit 9b3102b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Test.pm
Expand Up @@ -29,6 +29,7 @@ my $todo_output = $*OUT;

try {
# XXX do this with dup or an analogous cross-platform construct
# XXX these should probably have :autoflush
my $output_h = open('/dev/stdout', :w);
my $failure_output_h = open('/dev/stderr', :w);
my $todo_output_h = open('/dev/stdout', :w);
Expand Down Expand Up @@ -446,6 +447,12 @@ END {
done;
}

for $output, $failure_output, $todo_output -> $handle {
next if $handle === ($*ERR|$*OUT);

$handle.close;
}

if $num_of_tests_failed > 0 {
exit($num_of_tests_failed min 254);
}
Expand Down

0 comments on commit 9b3102b

Please sign in to comment.