cmake: emu: qemu: return to ctrl-c

To avoid killing the QEMU process w/o also ending the 802.15.4
monitoring tool, we reassign the terminal's interrupt shortcut from ^C
to ^D. This change resets the shortcut to ^C after ending the QEMU
session.

Fixes #79131

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
This commit is contained in:
Florian Grandel 2024-09-23 05:50:18 +02:00 committed by Fabio Baltieri
commit dd08fe5893

View file

@ -257,15 +257,14 @@ elseif(QEMU_NET_STACK)
set_ifndef(NET_TOOLS ${ZEPHYR_BASE}/../tools/net-tools) # Default if not set set_ifndef(NET_TOOLS ${ZEPHYR_BASE}/../tools/net-tools) # Default if not set
list(APPEND PRE_QEMU_COMMANDS_FOR_server list(APPEND PRE_QEMU_COMMANDS_FOR_server
COMMAND
#Disable Ctrl-C to ensure that users won't accidentally exit #Disable Ctrl-C to ensure that users won't accidentally exit
#w/o killing the monitor. #w/o killing the monitor.
stty intr ^d COMMAND stty intr ^d
COMMAND
#This command is run in the background using '&'. This prevents #This command is run in the background using '&'. This prevents
#chaining other commands with '&&'. The command is enclosed in '{}' #chaining other commands with '&&'. The command is enclosed in '{}'
#to fix this. #to fix this.
{ COMMAND {
${NET_TOOLS}/monitor_15_4 ${NET_TOOLS}/monitor_15_4
${PCAP} ${PCAP}
/tmp/ip-stack-server /tmp/ip-stack-server
@ -274,9 +273,11 @@ elseif(QEMU_NET_STACK)
} }
) )
set(POST_QEMU_COMMANDS_FOR_server set(POST_QEMU_COMMANDS_FOR_server
COMMAND # Re-enable Ctrl-C.
COMMAND stty intr ^c
# Kill the monitor_15_4 sub-process # Kill the monitor_15_4 sub-process
pkill -P $$$$ COMMAND pkill -P $$$$
) )
endif() endif()
endif(QEMU_PIPE_STACK) endif(QEMU_PIPE_STACK)