summaryrefslogtreecommitdiff
path: root/t/op/closure.t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-08-07 10:12:44 +0000
committerNicholas Clark <nick@ccl4.org>2008-08-07 10:12:44 +0000
commit1c25d394345c1b97c9cfd949fe3d2e3296fd9681 (patch)
treeeae05365e0036fad7135cb0b5681b1c1fe146571 /t/op/closure.t
parent748a4b20dad489edbf351cfb9cf18f6da44f79f5 (diff)
downloadperl-1c25d394345c1b97c9cfd949fe3d2e3296fd9681.tar.gz
Use test.pl's tempfile().
p4raw-id: //depot/perl@34180
Diffstat (limited to 't/op/closure.t')
-rwxr-xr-xt/op/closure.t10
1 files changed, 3 insertions, 7 deletions
diff --git a/t/op/closure.t b/t/op/closure.t
index d1cab953a5..5e3bf45591 100755
--- a/t/op/closure.t
+++ b/t/op/closure.t
@@ -463,9 +463,8 @@ END
}
} else {
# No fork(). Do it the hard way.
- my $cmdfile = "tcmd$$"; $cmdfile++ while -e $cmdfile;
- my $errfile = "terr$$"; $errfile++ while -e $errfile;
- my @tmpfiles = ($cmdfile, $errfile);
+ my $cmdfile = tempfile();
+ my $errfile = tempfile();
open CMD, ">$cmdfile"; print CMD $code; close CMD;
my $cmd = which_perl();
$cmd .= " -w $cmdfile 2>$errfile";
@@ -477,18 +476,15 @@ END
{ local $/; $output = join '', <PERL> }
close PERL;
} else {
- my $outfile = "tout$$"; $outfile++ while -e $outfile;
- push @tmpfiles, $outfile;
+ my $outfile = tempfile();
system "$cmd >$outfile";
{ local $/; open IN, $outfile; $output = <IN>; close IN }
}
if ($?) {
printf "not ok: exited with error code %04X\n", $?;
- $debugging or do { 1 while unlink @tmpfiles };
exit;
}
{ local $/; open IN, $errfile; $errors = <IN>; close IN }
- 1 while unlink @tmpfiles;
}
print $output;
print STDERR $errors;