diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index f6989be3a..cf7027903 100755 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -890,20 +890,7 @@ impl Vm { break 'outer; } - EpollDispatch::Stdin => { - let mut out = [0u8; 64]; - let count = io::stdin() - .lock() - .read_raw(&mut out) - .map_err(Error::Console)?; - - if self.devices.console().input_enabled() { - self.devices - .console() - .queue_input_bytes(&out[..count]) - .map_err(Error::Console)?; - } - } + EpollDispatch::Stdin => self.handle_stdin()?, } } } @@ -1057,6 +1044,23 @@ impl Vm { pub fn get_memory(&self) -> Arc> { self.memory.clone() } + + pub fn handle_stdin(&self) -> Result<()> { + let mut out = [0u8; 64]; + let count = io::stdin() + .lock() + .read_raw(&mut out) + .map_err(Error::Console)?; + + if self.devices.console().input_enabled() { + self.devices + .console() + .queue_input_bytes(&out[..count]) + .map_err(Error::Console)?; + } + + Ok(()) + } } #[allow(unused)]