]> git.proxmox.com Git - pve-installer.git/commit
run command: avoid using 1 as special value
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 26 Feb 2024 13:34:09 +0000 (14:34 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 26 Feb 2024 13:37:32 +0000 (14:37 +0100)
commit06d1efe8235ca11738373e0215ac926949a3cb2e
tree20a599825612b514d93074886b6748f054455746
parent719d617f9ba2182a91bc713f25120026d19a4337
run command: avoid using 1 as special value

In Perl, the last expression of a block (e.g. of a method, eval) gets
returned if there's no explicit return statement. Quite often that is
truthy, i.e., 1.

As that was chosen as the special value for the CMD_FINISHED flag it
had quite a few false positives, causing weird effects and
installation failure.

Reserve that overly problematic value and chose 2 as new CMD_FINISHED
value, albeit it could be better to signal this even more explicitly,
like with a structured hash reference, but for now this is a good stop
gap.

Fixes: 23c5fbe ("sys: command: allow terminating the process early from log subroutine")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Proxmox/Sys/Command.pm