X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=src%2FPVE%2FTools.pm;h=13e70f1afe828baa50cc84f2eab650e6331b6d60;hb=91bae4c070fe0d592be203e29b921b8c54e21b25;hp=bd99914c58e780d4eba4204eb500e739ae000b15;hpb=e8c13610c4196f895efeabaf20f5ec8afccf6ae0;p=pve-common.git diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm index bd99914..13e70f1 100644 --- a/src/PVE/Tools.pm +++ b/src/PVE/Tools.pm @@ -150,7 +150,7 @@ sub lock_file_full { or die "can't open file - $!\n"; if (!flock($fh, $mode|LOCK_NB)) { - print STDERR "trying to acquire lock..."; + print STDERR "trying to acquire lock...\n"; my $success; while(1) { $success = flock($fh, $mode); @@ -945,7 +945,11 @@ sub run_fork_with_timeout { $error = $child_res->{error}; }; eval { - run_with_timeout($timeout, $readvalues); + if (defined($timeout)) { + run_with_timeout($timeout, $readvalues); + } else { + $readvalues->(); + } }; warn $@ if $@; $pipe_out->close(); @@ -959,6 +963,11 @@ sub run_fork_with_timeout { return $res; } +sub run_fork { + my ($code) = @_; + return run_fork_with_timeout(undef, $code); +} + # NOTE: NFS syscall can't be interrupted, so alarm does # not work to provide timeouts. # from 'man nfs': "Only SIGKILL can interrupt a pending NFS operation"