]> git.proxmox.com Git - pve-common.git/commit - src/PVE/Tools.pm
run with timeout: return if timeout happened in list context
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 1 Jul 2023 15:00:12 +0000 (17:00 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 1 Jul 2023 16:45:11 +0000 (18:45 +0200)
commita6aa0ae9453190e029dad43dfe3d19e830c1543a
tree770a943de169e775dd044d9c38757dc2a4a88883
parent0c4641dcf823c544fb49150817c931d82ae99cdc
run with timeout: return if timeout happened in list context

This can be relevant info do differentiate if an undef return value
happened due to the closure returning it or if it happened due to a
timeout.

While for quite a few cases this could be handled by a
variable captured by the passed closure code reference, acting as
messenger, that might often require needless wrapping.

Also run_fork_with_timeout warned errors of execution, but any such
error handling for an actual timeout is better handled at the call
site, as a context-less "got timeout" at STDERR or journal is really
not helpful.

I checked all call sites of both, run_fork_with_timeout and
run_with_timeout most do not use the result at all, and the ones that
do are in scalar context.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Tools.pm