mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-29 06:33:22 +00:00
1. Added ability to modify environment variables on ScriptContainers
2. Fixed bug, where child ScriptContainer would exit if return value had a JSON parse error
This commit is contained in:
@@ -703,7 +703,7 @@ void ILibProcessPipe_Process_SoftKill(ILibProcessPipe_Process p)
|
||||
#endif
|
||||
}
|
||||
|
||||
ILibProcessPipe_Process ILibProcessPipe_Manager_SpawnProcessEx3(ILibProcessPipe_Manager pipeManager, char* target, char* const* parameters, ILibProcessPipe_SpawnTypes spawnType, void *sid, int extraMemorySize)
|
||||
ILibProcessPipe_Process ILibProcessPipe_Manager_SpawnProcessEx4(ILibProcessPipe_Manager pipeManager, char* target, char* const* parameters, ILibProcessPipe_SpawnTypes spawnType, void *sid, void *envvars, int extraMemorySize)
|
||||
{
|
||||
ILibProcessPipe_Process_Object* retVal = NULL;
|
||||
|
||||
@@ -790,8 +790,8 @@ ILibProcessPipe_Process ILibProcessPipe_Manager_SpawnProcessEx3(ILibProcessPipe_
|
||||
info.dwFlags |= STARTF_USESTDHANDLES;
|
||||
}
|
||||
|
||||
if ((spawnType == ILibProcessPipe_SpawnTypes_DEFAULT && !CreateProcessA(target, parms, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &info, &processInfo)) ||
|
||||
(spawnType != ILibProcessPipe_SpawnTypes_DEFAULT && !CreateProcessAsUserA(userToken, target, parms, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &info, &processInfo)))
|
||||
if ((spawnType == ILibProcessPipe_SpawnTypes_DEFAULT && !CreateProcessA(target, parms, NULL, NULL, TRUE, CREATE_NO_WINDOW, envvars, NULL, &info, &processInfo)) ||
|
||||
(spawnType != ILibProcessPipe_SpawnTypes_DEFAULT && !CreateProcessAsUserA(userToken, target, parms, NULL, NULL, TRUE, CREATE_NO_WINDOW, envvars, NULL, &info, &processInfo)))
|
||||
{
|
||||
if (spawnType != ILibProcessPipe_SpawnTypes_DETACHED)
|
||||
{
|
||||
@@ -897,6 +897,11 @@ ILibProcessPipe_Process ILibProcessPipe_Manager_SpawnProcessEx3(ILibProcessPipe_
|
||||
{
|
||||
ignore_result(setuid((uid_t)UID));
|
||||
}
|
||||
while (envvars != NULL && ((char**)envvars)[0] != NULL)
|
||||
{
|
||||
setenv(((char**)envvars)[0], ((char**)envvars)[1], 1);
|
||||
envvars = (void*)((char*)envvars + 2 * sizeof(char*));
|
||||
}
|
||||
execv(target, parameters);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
@@ -66,10 +66,11 @@ void ILibProcessPipe_Pipe_SetBrokenPipeHandler(ILibProcessPipe_Pipe targetPipe,
|
||||
|
||||
ILibProcessPipe_Manager ILibProcessPipe_Manager_Create(void *chain);
|
||||
int ILibProcessPipe_Process_IsDetached(ILibProcessPipe_Process p);
|
||||
ILibProcessPipe_Process ILibProcessPipe_Manager_SpawnProcessEx3(ILibProcessPipe_Manager pipeManager, char* target, char* const* parameters, ILibProcessPipe_SpawnTypes spawnType, void *sessionId, int extraMemorySize);
|
||||
ILibProcessPipe_Process ILibProcessPipe_Manager_SpawnProcessEx4(ILibProcessPipe_Manager pipeManager, char* target, char* const* parameters, ILibProcessPipe_SpawnTypes spawnType, void *sessionId, void *envvars, int extraMemorySize);
|
||||
#define ILibProcessPipe_Manager_SpawnProcess(pipeManager, target, parameters) ILibProcessPipe_Manager_SpawnProcessEx2(pipeManager, target, parameters, ILibProcessPipe_SpawnTypes_DEFAULT, 0)
|
||||
#define ILibProcessPipe_Manager_SpawnProcessEx(pipeManager, target, parameters, spawnType) ILibProcessPipe_Manager_SpawnProcessEx2(pipeManager, target, parameters, spawnType, 0)
|
||||
#define ILibProcessPipe_Manager_SpawnProcessEx2(pipeManager, target, parameters, spawnType, extraMemorySize) ILibProcessPipe_Manager_SpawnProcessEx3(pipeManager, target, parameters, spawnType, NULL, extraMemorySize)
|
||||
#define ILibProcessPipe_Manager_SpawnProcessEx3(pipeManager, target, parameters, spawnType, sessionId, extraMemorySize) ILibProcessPipe_Manager_SpawnProcessEx4(pipeManager, target, parameters, spawnType, sessionId, NULL, extraMemorySize)
|
||||
#define ILibProcessPipe_Manager_SpawnProcessWithExtraPipeMemory(pipeManager, target, parameters, memorySize) ILibProcessPipe_Manager_SpawnProcessEx2(pipeManager, target, parameters, ILibProcessPipe_SpawnTypes_DEFAULT, memorySize)
|
||||
void ILibProcessPipe_Process_SoftKill(ILibProcessPipe_Process p);
|
||||
void ILibProcessPipe_Process_AddHandlers(ILibProcessPipe_Process module, int bufferSize, ILibProcessPipe_Process_ExitHandler exitHandler, ILibProcessPipe_Process_OutputHandler stdOut, ILibProcessPipe_Process_OutputHandler stdErr, ILibProcessPipe_Process_SendOKHandler sendOk, void *user);
|
||||
|
||||
Reference in New Issue
Block a user