fix: start udfd with env var

This commit is contained in:
xsren 2024-07-18 09:58:23 +08:00
parent 26cc04ca7c
commit 24183d3f86
2 changed files with 7 additions and 0 deletions

View File

@ -71,6 +71,7 @@ void udfUdfdExit(uv_process_t *process, int64_t exitStatus, int termSignal) {
} }
} }
extern char **environ;
static int32_t udfSpawnUdfd(SUdfdData *pData) { static int32_t udfSpawnUdfd(SUdfdData *pData) {
fnInfo("start to init udfd"); fnInfo("start to init udfd");
uv_process_options_t options = {0}; uv_process_options_t options = {0};
@ -117,6 +118,7 @@ static int32_t udfSpawnUdfd(SUdfdData *pData) {
child_stdio[2].data.fd = 2; child_stdio[2].data.fd = 2;
options.stdio_count = 3; options.stdio_count = 3;
options.stdio = child_stdio; options.stdio = child_stdio;
options.env = environ;
options.flags = UV_PROCESS_DETACHED; options.flags = UV_PROCESS_DETACHED;

View File

@ -1421,22 +1421,26 @@ int main(int argc, char *argv[]) {
if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 0) != 0) { if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 0) != 0) {
fnError("failed to start since read config error"); fnError("failed to start since read config error");
taosCloseLog();
return -2; return -2;
} }
initEpSetFromCfg(tsFirst, tsSecond, &global.mgmtEp); initEpSetFromCfg(tsFirst, tsSecond, &global.mgmtEp);
if (udfdOpenClientRpc() != 0) { if (udfdOpenClientRpc() != 0) {
fnError("open rpc connection to mnode failed"); fnError("open rpc connection to mnode failed");
taosCloseLog();
return -3; return -3;
} }
if (udfdCreateUdfSourceDir() != 0) { if (udfdCreateUdfSourceDir() != 0) {
fnError("create udf source directory failed"); fnError("create udf source directory failed");
taosCloseLog();
return -4; return -4;
} }
if (udfdUvInit() != 0) { if (udfdUvInit() != 0) {
fnError("uv init failure"); fnError("uv init failure");
taosCloseLog();
return -5; return -5;
} }
@ -1452,6 +1456,7 @@ int main(int argc, char *argv[]) {
udfdDeinitScriptPlugins(); udfdDeinitScriptPlugins();
taosCloseLog();
udfdCleanup(); udfdCleanup();
return 0; return 0;
} }