From e6ef9ece2ccf7f33f28f1726ee61ce573eecdb9c Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Tue, 24 Sep 2019 16:06:56 +0200 Subject: [PATCH] vmm: Move the tty setting to the VM start routine We want to shrink the control loop to a bare minimal. Signed-off-by: Samuel Ortiz --- vmm/src/vm.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index 452948ee7..92dd364b6 100755 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -851,13 +851,6 @@ impl Vm { let mut events = vec![epoll::Event::new(epoll::Events::empty(), 0); EPOLL_EVENTS_LEN]; let epoll_fd = self.epoll.as_raw_fd(); - if self.devices.console().input_enabled() && self.on_tty { - io::stdin() - .lock() - .set_raw_mode() - .map_err(Error::SetTerminalRaw)?; - } - let exit_behaviour; 'outer: loop { @@ -1044,7 +1037,15 @@ impl Vm { } Err(e) => error!("Signal not found {}", e), } + + if self.on_tty { + io::stdin() + .lock() + .set_raw_mode() + .map_err(Error::SetTerminalRaw)?; + } } + self.control_loop() }