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,
};
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);
}
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);
}
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);
}
}