]> git.proxmox.com Git - pve-common.git/commitdiff
run_command: return exit code and add noerr
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 30 Nov 2015 08:25:20 +0000 (09:25 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 30 Nov 2015 11:59:45 +0000 (12:59 +0100)
Allow to return the exit code of the executed command.
And as we do not reach the return of the exit code if it was not 0,
a noerr parameter is also needed so we can suppress the 'command
failed' die in case of an exit code unequal to 0.

This is required as some programs return another value than 0 when
they succeed, For example `systemctl list-jobs` returns  a value
>= 0 on a successful execution, normally 1.
Without this patch a run_command call to `systemctl list-jobs` gets
marked as failed although it was successful.

This does not break current behaviour in any way as setting the
noerr parameter is required to return something other than 0 or
undef, which are equal in a boolean comparison.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>

No differences found