From 1d8a79fad40b867c1e7b963082bab54c8998f9ec Mon Sep 17 00:00:00 2001 From: weiqiushi Date: Wed, 12 Apr 2023 15:05:37 +0800 Subject: [PATCH] Issue #198: AppManager return timeout error when execut install command in docker container --- src/service/app-manager/src/docker_api.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/service/app-manager/src/docker_api.rs b/src/service/app-manager/src/docker_api.rs index ca8c0970..64430993 100644 --- a/src/service/app-manager/src/docker_api.rs +++ b/src/service/app-manager/src/docker_api.rs @@ -264,16 +264,19 @@ impl DockerApi { match child.wait_timeout(Duration::from_secs(INSTALL_CMD_TIME_OUT_IN_SECS))? { None => { - error!("app {} run install cmd {} not return after {} secs, kill", id, &cmd, INSTALL_CMD_TIME_OUT_IN_SECS); + let msg = format!("app {} run install cmd {} not return after {} secs, kill", id, &cmd, INSTALL_CMD_TIME_OUT_IN_SECS); + error!("{}", &msg); let _ = child.kill(); let _ = child.wait(); + return Err(BuckyError::new(BuckyErrorCode::Timeout, msg)); } Some(status) => { if status.success() { info!("app {} run install cmd {} success", id, &cmd); } else { - error!("app {} run install cmd {}, exit code {}", id, &cmd, code_to_string(status.code())); - return Err(BuckyError::from(BuckyErrorCode::Failed)); + let msg = format!("app {} run install cmd {}, exit code {}", id, &cmd, code_to_string(status.code())); + error!("{}", &msg); + return Err(BuckyError::new(BuckyErrorCode::Failed, msg)); } } }