diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-08-07 10:12:44 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-08-07 10:12:44 +0000 |
commit | 1c25d394345c1b97c9cfd949fe3d2e3296fd9681 (patch) | |
tree | eae05365e0036fad7135cb0b5681b1c1fe146571 /t/op/closure.t | |
parent | 748a4b20dad489edbf351cfb9cf18f6da44f79f5 (diff) | |
download | perl-1c25d394345c1b97c9cfd949fe3d2e3296fd9681.tar.gz |
Use test.pl's tempfile().
p4raw-id: //depot/perl@34180
Diffstat (limited to 't/op/closure.t')
-rwxr-xr-x | t/op/closure.t | 10 |
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; |