mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 14:54:19 +01:00
Merge pull request #6426 from openanolis/runtime-rs-resize-pty
bugfix: modify tty_win info in runtime when handling ResizePtyRequest
This commit is contained in:
@@ -344,20 +344,33 @@ impl Container {
|
|||||||
height: u32,
|
height: u32,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let logger = logger_with_process(process);
|
let logger = logger_with_process(process);
|
||||||
let inner = self.inner.read().await;
|
let mut inner = self.inner.write().await;
|
||||||
if inner.init_process.get_status().await != ProcessStatus::Running {
|
if inner.init_process.get_status().await != ProcessStatus::Running {
|
||||||
warn!(logger, "container is not running");
|
warn!(logger, "container is not running");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
self.agent
|
|
||||||
.tty_win_resize(agent::TtyWinResizeRequest {
|
if process.exec_id.is_empty() {
|
||||||
process_id: process.clone().into(),
|
inner.init_process.height = height;
|
||||||
row: height,
|
inner.init_process.width = width;
|
||||||
column: width,
|
} else if let Some(exec) = inner.exec_processes.get_mut(&process.exec_id) {
|
||||||
})
|
exec.process.height = height;
|
||||||
.await
|
exec.process.width = width;
|
||||||
.context("resize pty")?;
|
|
||||||
Ok(())
|
// for some case, resize_pty request should be handled while the process has not been started in agent
|
||||||
|
// just return here, and truly resize_pty will happen in start_process
|
||||||
|
if exec.process.get_status().await != ProcessStatus::Running {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return Err(anyhow!(
|
||||||
|
"could not find process {} in container {}",
|
||||||
|
process.exec_id(),
|
||||||
|
process.container_id()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
inner.win_resize_process(process, height, width).await
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn stats(&self) -> Result<Option<agent::StatsContainerResponse>> {
|
pub async fn stats(&self) -> Result<Option<agent::StatsContainerResponse>> {
|
||||||
|
|||||||
Reference in New Issue
Block a user