diff --git a/common/appspawn_server.c b/common/appspawn_server.c index a03b5409348f1fc5e3226f2699d3843291c564ef..da4fca546b67addc2e98f8fadfa5936996640062 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 0026d051f15dd28c2543da90526cef64ca1d9c61..614aa1036143ba97c5dca202215882fd7d37a0f9 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 = [ ".",