mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-06 00:13:33 +00:00
Add ability to specify detached=true in options
This commit is contained in:
@@ -276,6 +276,7 @@ duk_ret_t ILibDuktape_ChildProcess_execFile(duk_context *ctx)
|
||||
// Options
|
||||
spawnType = (ILibProcessPipe_SpawnTypes)Duktape_GetIntPropertyValue(ctx, i, "type", (int)ILibProcessPipe_SpawnTypes_DEFAULT);
|
||||
uid = Duktape_GetIntPropertyValue(ctx, i, "uid", -1);
|
||||
if (Duktape_GetBooleanProperty(ctx, i, "detached", 0) != 0) { spawnType = ILibProcessPipe_SpawnTypes_POSIX_DETACHED; }
|
||||
#ifdef WIN32
|
||||
if (uid >= 0 && spawnType == ILibProcessPipe_SpawnTypes_USER) { spawnType = ILibProcessPipe_SpawnTypes_SPECIFIED_USER; }
|
||||
#endif
|
||||
|
||||
@@ -936,6 +936,10 @@ ILibProcessPipe_Process ILibProcessPipe_Manager_SpawnProcessEx4(ILibProcessPipe_
|
||||
{
|
||||
ignore_result(setuid((uid_t)UID));
|
||||
}
|
||||
if (spawnType == ILibProcessPipe_SpawnTypes_POSIX_DETACHED)
|
||||
{
|
||||
ignore_result(setsid());
|
||||
}
|
||||
while (envvars != NULL && ((char**)envvars)[0] != NULL)
|
||||
{
|
||||
setenv(((char**)envvars)[0], ((char**)envvars)[1], 1);
|
||||
|
||||
@@ -40,7 +40,8 @@ typedef enum ILibProcessPipe_SpawnTypes
|
||||
ILibProcessPipe_SpawnTypes_WINLOGON = 2,
|
||||
ILibProcessPipe_SpawnTypes_TERM = 3,
|
||||
ILibProcessPipe_SpawnTypes_DETACHED = 4,
|
||||
ILibProcessPipe_SpawnTypes_SPECIFIED_USER = 5
|
||||
ILibProcessPipe_SpawnTypes_SPECIFIED_USER = 5,
|
||||
ILibProcessPipe_SpawnTypes_POSIX_DETACHED=6
|
||||
}ILibProcessPipe_SpawnTypes;
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
Reference in New Issue
Block a user