Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run in a new process group when not using --foreground
Previously the hostagenet process was running in the foreground even when not using the --foreground option. It was using the same pgid of limactl process. If the guest was running, but limactl was interrupted the hostagent received the signal and was killed, stopping the VM. A simple way to fix this issue is to start the hostagent process in a new process group. This way it will be killed sending signals to the limactl process group. It looks like this is already implemented for Windows based on the docs for syscall.CREATE_NEW_PROCESS_GROUP[1]. Example run with this change: % ps -o pid,pgid,ppid,command PID PGID PPID COMMAND 39442 39442 39440 -zsh 63233 63233 39442 _output/bin/limactl start --vm-type vz --tty=false 63299 63299 63233 /Users/nsoffer/src/lima/_output/bin/limactl hostagent ... We can improve this later by adding an option to daemonize the hostagent process (like qemu --daemonize). [1] https://learn.microsoft.com/en-us/windows/win32/procthread/process-creation-flags Fixes #2573 Signed-off-by: Nir Soffer <[email protected]>
- Loading branch information