X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Fclosure.t;h=5e3bf455911ed33ac94d97d2328302651aab53ba;hb=1c25d394345c1b97c9cfd949fe3d2e3296fd9681;hp=d1cab953a5696de1aa0c145ef350393fcac57971;hpb=748a4b20dad489edbf351cfb9cf18f6da44f79f5;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/closure.t b/t/op/closure.t index d1cab95..5e3bf45 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 '', } close PERL; } else { - my $outfile = "tout$$"; $outfile++ while -e $outfile; - push @tmpfiles, $outfile; + my $outfile = tempfile(); system "$cmd >$outfile"; { local $/; open IN, $outfile; $output = ; 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 = ; close IN } - 1 while unlink @tmpfiles; } print $output; print STDERR $errors;