From d78cae6db99e54646a3ed61fb13063f69005be6c Mon Sep 17 00:00:00 2001 From: laiguizhong Date: Thu, 19 May 2022 21:13:12 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20ac0a29e=20from=20https://gitee.com/YiYi?= =?UTF-8?q?Yiol/startup=5Fappspawn/pulls/228=20=E4=BF=AE=E6=94=B9appspawn?= =?UTF-8?q?=E5=AD=90=E8=BF=9B=E7=A8=8B=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: laiguizhong --- common/appspawn_server.c | 16 ++++++++++++++-- lite/BUILD.gn | 5 ++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/common/appspawn_server.c b/common/appspawn_server.c index a03b5409..da4fca54 100644 --- a/common/appspawn_server.c +++ b/common/appspawn_server.c @@ -15,6 +15,7 @@ #include "appspawn_server.h" +#include #include #include #include @@ -30,6 +31,18 @@ static int NotifyResToParent(struct AppSpawnContent_ *content, AppSpawnClient *c return 0; } +static void ProcessExit(void) +{ + APPSPAWN_LOGI("App exit %d.", getpid()); +#ifdef OHOS_LITE + _exit(0x7f); // 0x7f user exit +#else +#ifndef APPSPAWN_TEST + quick_exit(0); +#endif +#endif +} + int DoStartApp(struct AppSpawnContent_ *content, AppSpawnClient *client, char *longProcName, uint32_t longProcNameLen) { APPSPAWN_LOGI("DoStartApp id %d longProcNameLen %u", client->id, longProcNameLen); @@ -119,8 +132,7 @@ int AppSpawnProcessMsg(struct AppSpawnContent_ *content, AppSpawnClient *client, if (ret == 0 && content->runChildProcessor != NULL) { content->runChildProcessor(content, client); } - APPSPAWN_LOGI("App exit %d.", getpid()); - _exit(0x7f); // 0x7f user exit + ProcessExit(); } *childPid = pid; return 0; diff --git a/lite/BUILD.gn b/lite/BUILD.gn index 0026d051..614aa103 100644 --- a/lite/BUILD.gn +++ b/lite/BUILD.gn @@ -38,7 +38,10 @@ executable("appspawn") { "-Wno-format-extra-args", ] - defines = [ "_GNU_SOURCE" ] + defines = [ + "_GNU_SOURCE", + "OHOS_LITE", + ] include_dirs = [ ".", -- Gitee