From 2e5295c08f1c5ed7c93dd5698733f8b9abe17848 Mon Sep 17 00:00:00 2001 From: mengwei Date: Wed, 19 Jul 2023 11:28:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0ams=20shell=20command?= =?UTF-8?q?=E6=89=93=E5=8D=B0=20Signed-off-by:=20mengwei=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/aa/src/shell_command_executor.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/aa/src/shell_command_executor.cpp b/tools/aa/src/shell_command_executor.cpp index e81856d80dc..e5f39b8df0c 100644 --- a/tools/aa/src/shell_command_executor.cpp +++ b/tools/aa/src/shell_command_executor.cpp @@ -90,6 +90,7 @@ bool ShellCommandExecutor::DoWork() HILOG_INFO("DoWork async task begin, cmd : \"%{public}s\"", cmd_.data()); FILE* file = popen(cmd_.c_str(), "r"); + HILOG_INFO("DoWork async task 93 line, cmd : \"%{public}s\"", cmd_.data()); if (!file) { HILOG_ERROR("Failed to call popen, cmd : \"%{public}s\"", cmd_.data()); @@ -101,23 +102,30 @@ bool ShellCommandExecutor::DoWork() HILOG_INFO("DoWork async task end, cmd : \"%{public}s\"", cmd_.data()); return; } - + HILOG_INFO("DoWork async task 105 line, cmd : \"%{public}s\"", cmd_.data()); char commandResult[1024] = { '\0' }; while ((fgets(commandResult, sizeof(commandResult), file)) != nullptr) { { + HILOG_INFO("DoWork async task 109 line"); std::lock_guard copyLock(mtxCopy_); + HILOG_INFO("DoWork async task 111 line"); cmdResult_.stdResult.append(commandResult); + HILOG_INFO("DoWork async task 113 line"); + } + HILOG_INFO("DoWork async task 116 line"); std::cout << commandResult; + HILOG_INFO("DoWork async task 118 line"); } - + HILOG_INFO("DoWork async task 120 line"); cmdResult_.exitCode = pclose(file); file = nullptr; - + HILOG_INFO("DoWork async task 123 line"); { std::unique_lock workLock(mtxWork_); isDone_ = true; } + HILOG_INFO("DoWork async task 128 line"); cvWork_.notify_one(); HILOG_INFO("DoWork async task end, cmd : \"%{public}s\"", cmd_.data()); }); -- Gitee