parallel: tmpfile now returns only a filehandle if in scalar context.

This commit is contained in:
Ole Tange 2016-09-22 23:53:32 +02:00
parent bd38a6ac54
commit 5829f512c1

View file

@ -3898,7 +3898,15 @@ sub tmpfile {
# Returns: # Returns:
# $filehandle = opened file handle # $filehandle = opened file handle
# $filename = file name created # $filename = file name created
return ::tempfile(DIR=>$ENV{'TMPDIR'}, TEMPLATE => 'parXXXXX', @_); my($filehandle,$filename) =
::tempfile(DIR=>$ENV{'TMPDIR'}, TEMPLATE => 'parXXXXX', @_);
if(wantarray) {
return($filehandle,$filename);
} else {
# Separate unlink due to NFS dealing badly with File::Temp
unlink $filename;
return $filehandle;
}
} }
sub tmpname { sub tmpname {
@ -4092,10 +4100,7 @@ sub multiply_binary_prefix {
# Returns: # Returns:
# N/A # N/A
if(not $disk_full_fh) { if(not $disk_full_fh) {
my $name; $disk_full_fh = ::tmpfile(SUFFIX => ".df");
($disk_full_fh, $name) = ::tmpfile(SUFFIX => ".df");
# Separate unlink due to NFS dealing badly with File::Temp
unlink $name;
$b8193 = "x"x8193; $b8193 = "x"x8193;
} }
# Linux does not discover if a disk is full if writing <= 8192 # Linux does not discover if a disk is full if writing <= 8192
@ -4251,6 +4256,7 @@ sub which {
%pid_parentpid_cmd = %pid_parentpid_cmd =
( (
'aix' => $sysv, 'aix' => $sysv,
'android' => $sysv,
'cygwin' => $sysv, 'cygwin' => $sysv,
'darwin' => $bsd, 'darwin' => $bsd,
'dec_osf' => $sysv, 'dec_osf' => $sysv,