coconut-svsm / svsm

COCONUT-SVSM
MIT License
122 stars 42 forks source link

scripts/launch_guest.sh: fix restoring of terminal settings #497

Closed stefano-garzarella closed 4 weeks ago

stefano-garzarella commented 4 weeks ago

The script runs with set -e, so if QEMU fails, we never restore Ctrl-C remapping to Ctrl-].

For example, this happens all the time when we run scripts/test-in-svsm.sh because QEMU exits with a value other than 0 (perhaps due to exit via isa-debug-exit).

To solve it, set a handler to re-install them when the script exits, also save the original values to restore exactly the initial configuration.