mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 21:55:20 +00:00
vmm: Only send stdin input to serial/console if it can handle it
Do not send the contents of stdin to the serial or console device if they're not in tty mode. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
aa44726658
commit
f910476dd7
@ -352,6 +352,15 @@ pub enum ConsoleOutputMode {
|
||||
File,
|
||||
}
|
||||
|
||||
impl ConsoleOutputMode {
|
||||
pub fn input_enabled(&self) -> bool {
|
||||
match self {
|
||||
ConsoleOutputMode::Tty => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ConsoleConfig<'a> {
|
||||
pub file: Option<&'a Path>,
|
||||
pub mode: ConsoleOutputMode,
|
||||
|
@ -1489,7 +1489,9 @@ impl<'a> Vm<'a> {
|
||||
.read_raw(&mut out)
|
||||
.map_err(Error::Serial)?;
|
||||
|
||||
if self.devices.serial.is_some() {
|
||||
if self.devices.serial.is_some()
|
||||
&& self.config.serial.mode.input_enabled()
|
||||
{
|
||||
self.devices
|
||||
.serial
|
||||
.as_ref()
|
||||
@ -1500,7 +1502,9 @@ impl<'a> Vm<'a> {
|
||||
.map_err(Error::Serial)?;
|
||||
}
|
||||
|
||||
if self.devices.console.is_some() {
|
||||
if self.devices.console.is_some()
|
||||
&& self.config.console.mode.input_enabled()
|
||||
{
|
||||
self.devices
|
||||
.console
|
||||
.as_ref()
|
||||
|
Loading…
Reference in New Issue
Block a user