Skip to content

Commit

Permalink
incusd/instance/qemu: Improve error handling
Browse files Browse the repository at this point in the history
This generally improves the error handling around finding processes and
works around a Go change in tip.

Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Feb 22, 2024
1 parent 8f5f80e commit c20a2c3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/server/instance/drivers/driver_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,12 +807,16 @@ func (d *qemu) ovmfPath() string {
func (d *qemu) killQemuProcess(pid int) error {
proc, err := os.FindProcess(pid)
if err != nil {
if err == os.ErrProcessDone {
return nil
}

return err
}

err = proc.Kill()
if err != nil {
if strings.Contains(err.Error(), "process already finished") {
if err == os.ErrProcessDone {
return nil
}

Expand Down

0 comments on commit c20a2c3

Please sign in to comment.