Skip to content

Commit

Permalink
Added recovery step for failed QEMU operation (#112)
Browse files Browse the repository at this point in the history
On current QEMU versions, failed to exit cleanly will cause the current
session of command line unable to echo typed characters.

This change added a step to try to recover from such state, in Linux,
when QEMU returns with errors.
  • Loading branch information
kuqin12 authored Oct 28, 2022
1 parent f2a01bd commit 4f70d49
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Platforms/QemuQ35Pkg/Plugins/QemuRunner/QemuRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ def Runner(env):
# Run QEMU
#ret = QemuRunner.RunCmd(executable, args, thread_target=QemuRunner.QemuCmdReader)
ret = utility_functions.RunCmd(executable, args)
if ret != 0 and os.name != 'nt':
# Linux version of QEMU will mess with the print if its run failed, this is to restore it
utility_functions.RunCmd ('stty', 'echo')

## TODO: restore the customized RunCmd once unit tests with asserts are figured out
if ret == 0xc0000005:
ret = 0
Expand Down

0 comments on commit 4f70d49

Please # to comment.