Commit Graph

7 Commits

Author SHA1 Message Date
Christoph Heiss
7a95f3873f sys: command: handle EINTR in run_command()
Previously, the I/O loop would continue endlessly until the subprocess
exited.
This explicit handling allows run_command() to be used with e.g.
alarm().

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-02-23 14:19:56 +01:00
Christoph Heiss
152bbef439 sys: command: factor out kill() + waitpid() from run_command()
This moves the kill() + waitpid() combo into a separate subroutine,
avoiding open-coding that sequence. wait_for_process() also handles
properly unkillable process (e.g. in D-state) and avoids completely
locking up the installer in such cases. See [0].

For the latter case, a timeout exists (with a default of 5 seconds) in
which to wait for the process to exit after sending an optional
TERM/KILL signal.

Also while at it, add a few basic tests for run_command().

[0] https://lists.proxmox.com/pipermail/pve-devel/2024-February/061697.html

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-02-23 14:19:56 +01:00
Thomas Lamprecht
499af19fe0 sys command: add missing imports, switch to UI for event processing
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-20 16:00:47 +02:00
Thomas Lamprecht
026620be2f rename Env to ISOEnv
in preparation of adding a runtime env module

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-14 13:26:38 +02:00
Thomas Lamprecht
7b0a64c1bf sys cmd: use croak instead of die for caller context
it's more useful if those errors contain the caller site location

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-09 09:36:58 +02:00
Thomas Lamprecht
8357edf5d0 rename Proxmox::Install::Setup to Proxmox::Install::Env
slightly better fit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-09 09:36:58 +02:00
Thomas Lamprecht
d9ba239d39 factor out command execution helpers
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-09 09:36:58 +02:00