Skip to content
Snippets Groups Projects
Commit e308e579 authored by Guy Zana's avatar Guy Zana
Browse files

run: save tty state and restore it after launching qemu

apparently when qemu is started with networking the tty isn't restored
successfully, this patch handles this
parent 70d892db
No related branches found
No related tags found
No related merge requests found
...@@ -3,9 +3,21 @@ import subprocess ...@@ -3,9 +3,21 @@ import subprocess
import sys import sys
import argparse import argparse
stty_params=None
def stty_save():
global stty_params
p = subprocess.Popen(["stty", "-g"], stdout=subprocess.PIPE)
stty_params, err = p.communicate()
stty_params = stty_params.strip()
def stty_restore():
if (stty_params):
subprocess.call(["stty", stty_params])
def cleanups(): def cleanups():
"cleanups after execution" "cleanups after execution"
pass stty_restore()
def set_imgargs(): def set_imgargs():
if (not cmdargs.execute): if (not cmdargs.execute):
...@@ -35,6 +47,10 @@ def start_osv(): ...@@ -35,6 +47,10 @@ def start_osv():
args += ["-device", "virtio-net-pci"] args += ["-device", "virtio-net-pci"]
try: try:
# Save the current settings of the stty
stty_save()
# Launch qemu
subprocess.call(["qemu-system-x86_64"] + args) subprocess.call(["qemu-system-x86_64"] + args)
except: except:
pass pass
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment