From b4695f630326b5904fbfdfd6df68674ec701f2bc Mon Sep 17 00:00:00 2001 From: Xuewei Niu Date: Tue, 10 Dec 2024 17:12:36 +0800 Subject: [PATCH] runtime-rs: Fix the issues with stderr fifo When tty is enabled, stderr fifo should never be opened. Fixes: #10637 Signed-off-by: Xuewei Niu --- .../virt_container/src/container_manager/process.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/runtime-rs/crates/runtimes/virt_container/src/container_manager/process.rs b/src/runtime-rs/crates/runtimes/virt_container/src/container_manager/process.rs index 17b2fde464..52ab122a88 100644 --- a/src/runtime-rs/crates/runtimes/virt_container/src/container_manager/process.rs +++ b/src/runtime-rs/crates/runtimes/virt_container/src/container_manager/process.rs @@ -128,11 +128,13 @@ impl Process { pub fn pre_fifos_open(&mut self) -> Result<()> { if let Some(ref stdout) = self.stdout { - self.stdout_r = Some(open_fifo_read(stdout)?); + self.stdout_r = Some(open_fifo_read(stdout).context("open stdout")?); } - if let Some(ref stderr) = self.stderr { - self.stderr_r = Some(open_fifo_read(stderr)?); + if !self.terminal { + if let Some(ref stderr) = self.stderr { + self.stderr_r = Some(open_fifo_read(stderr).context("open stderr")?); + } } Ok(())