Change log messages of executing echo 27/300227/1
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 19 Oct 2023 04:08:55 +0000 (13:08 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 19 Oct 2023 04:08:55 +0000 (13:08 +0900)
The error message is added.

Change-Id: I18518c4806e2de0bdd9d6515940798fda8b7849a
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/launchpad-process-pool/app_executor.cc

index f534aef..d2e17f8 100644 (file)
@@ -44,11 +44,13 @@ namespace launchpad {
 namespace fs = std::filesystem;
 namespace {
 
-void ExecuteEcho(const std::string& app_path) {
+void ExecuteEcho(const std::string& app_path, const std::string& error) {
   char *argv[] = {
       const_cast<char*>("/usr/bin/echo"),
-      const_cast<char*>("Failed to execute a file. path: "),
+      const_cast<char*>("Failed to execute a file. path:"),
       const_cast<char*>(app_path.c_str()),
+      const_cast<char*>("error:"),
+      const_cast<char*>(error.c_str()),
       nullptr,
   };
 
@@ -120,7 +122,7 @@ void AppExecutor::OnExecution() {
   if (ret < 0) {
     _E("Failed to prepare executing application(%s)",
         app_info_->GetAppId().c_str());
-    ExecuteEcho(app_info_->GetAppPath());
+    ExecuteEcho(app_info_->GetAppPath(), std::to_string(ret));
     exit(ret);
   }
 
@@ -129,7 +131,7 @@ void AppExecutor::OnExecution() {
   char** app_argv = static_cast<char**>(calloc(argv.size() + 1, sizeof(char*)));
   if (app_argv == nullptr) {
     _E("Out of memory");
-    ExecuteEcho(app_info_->GetAppPath());
+    ExecuteEcho(app_info_->GetAppPath(), std::to_string(-ENOMEM));
     exit(-1);
   }
 
@@ -149,7 +151,7 @@ void AppExecutor::OnExecution() {
     fprintf(stderr, "Failed to exeucte a file. path: %s, errno: %d(%s)\n",
         app_info_->GetAppPath().c_str(), errno,
         strerror_r(errno, err_buf, sizeof(err_buf)));
-    ExecuteEcho(app_info_->GetAppPath());
+    ExecuteEcho(app_info_->GetAppPath(), err_buf);
     exit(EXIT_FAILURE);
   }
 }