From 60d1d97297fada832c1424d978a12657ce840d14 Mon Sep 17 00:00:00 2001 From: Gerorge Liao Date: Wed, 26 Jun 2024 11:12:23 +0200 Subject: [PATCH] [qemu vm] added if empty check to pass unit tests and check the return boolean of wait_for_finished and log correspondingly. --- src/platform/backends/qemu/qemu_virtual_machine.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/platform/backends/qemu/qemu_virtual_machine.cpp b/src/platform/backends/qemu/qemu_virtual_machine.cpp index 19d454a8c0..d18ac8dd34 100644 --- a/src/platform/backends/qemu/qemu_virtual_machine.cpp +++ b/src/platform/backends/qemu/qemu_virtual_machine.cpp @@ -367,7 +367,10 @@ void mp::QemuVirtualMachine::shutdown(const bool force) mpl::log(mpl::Level::info, vm_name, "Killing process"); lock.unlock(); vm_process->kill(); - vm_process->wait_for_finished(timeout); + if (vm_process != nullptr && !vm_process->wait_for_finished(timeout)) + { + mpl::log(mpl::Level::error, vm_name, "Killing qemu process could not finish."); + } } else {