From 48e49fac563878d9ca49c009efd2de4ff31d1831 Mon Sep 17 00:00:00 2001 From: Florian Grandel Date: Mon, 2 Sep 2024 11:06:44 +0200 Subject: [PATCH] cmake: emu: qemu: pkill monitor_15_4 The IEEE 801.15.4 monitor can be started by a parameter to cmake. This change removes a TODO to kill the monitor after qemu ends. The change also re-assigns Ctrl-C to Ctrl-D to ensure that QEMU is not inadvertently sending SIGINT to the surrounding ninja session (which would leave the monitor sub-process alive). Signed-off-by: Florian Grandel --- cmake/emu/qemu.cmake | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmake/emu/qemu.cmake b/cmake/emu/qemu.cmake index 0fd445f3c59..f7ee1915a27 100644 --- a/cmake/emu/qemu.cmake +++ b/cmake/emu/qemu.cmake @@ -257,6 +257,10 @@ elseif(QEMU_NET_STACK) set_ifndef(NET_TOOLS ${ZEPHYR_BASE}/../net-tools) # Default if not set list(APPEND PRE_QEMU_COMMANDS_FOR_server + COMMAND + #Disable Ctrl-C to ensure that users won't accidentally exit + #w/o killing the monitor. + stty intr ^d COMMAND #This command is run in the background using '&'. This prevents #chaining other commands with '&&'. The command is enclosed in '{}' @@ -268,7 +272,11 @@ elseif(QEMU_NET_STACK) /tmp/ip-stack-client > /dev/null & } - # TODO: Support cleanup of the monitor_15_4 process + ) + set(POST_QEMU_COMMANDS_FOR_server + COMMAND + # Kill the monitor_15_4 sub-process + pkill -P $$$$ ) endif() endif(QEMU_PIPE_STACK) @@ -440,6 +448,7 @@ foreach(target ${qemu_targets}) ${MORE_FLAGS_FOR_${target}} ${QEMU_SMP_FLAGS} ${QEMU_KERNEL_OPTION} + ${POST_QEMU_COMMANDS_FOR_${target}} DEPENDS ${logical_target_for_zephyr_elf} WORKING_DIRECTORY ${APPLICATION_BINARY_DIR} COMMENT "${QEMU_PIPE_COMMENT}[QEMU] CPU: ${QEMU_CPU_TYPE_${ARCH}}"