mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-26 16:07:54 +00:00
parallel: Only move the tmp-uptime file if 'uptime' succeeds
This commit is contained in:
parent
acfaa04f19
commit
76ae522c84
|
@ -1971,7 +1971,7 @@ sub loadavg {
|
||||||
# save it to a tmp file before moving it to the correct file
|
# save it to a tmp file before moving it to the correct file
|
||||||
my $file = $self->{'loadavg_file'};
|
my $file = $self->{'loadavg_file'};
|
||||||
my $tmpfile = $self->{'loadavg_file'}.$$;
|
my $tmpfile = $self->{'loadavg_file'}.$$;
|
||||||
qx{ ($uptime > $tmpfile; mv $tmpfile $file) & };
|
qx{ ($uptime > $tmpfile && mv $tmpfile $file) & };
|
||||||
}
|
}
|
||||||
return $self->{'loadavg'};
|
return $self->{'loadavg'};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue