runtime-rs: fix ctr exit failed
During use, there will be cases where the container is in the stop state
and get another stop. In this case, the second stop needs to be ignored.
Fixes:
@@ -193,7 +193,13 @@ impl ContainerInner {
) -> Result<()> {
let logger = logger_with_process(process);
info!(logger, "begin to stop process");
+
// do not stop again when state stopped, may cause multi cleanup resource
+ let state = self.init_process.get_status().await;
+ if state == ProcessStatus::Stopped {
+ return Ok(());
+ }
+
self.check_state(vec![ProcessStatus::Running])
.await
.context("check state")?;
