1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 15:53:55 +00:00

Added pid check for forkpty() initialization

This commit is contained in:
Bryan Roe
2020-02-05 13:07:56 -08:00
parent ee10dbeb17
commit 937ae3b5d2

View File

@@ -955,6 +955,8 @@ ILibProcessPipe_Process ILibProcessPipe_Manager_SpawnProcessEx4(ILibProcessPipe_
pid = forkpty(&pipe, NULL, flags == 0 ? NULL : &tios, &w); pid = forkpty(&pipe, NULL, flags == 0 ? NULL : &tios, &w);
if (pid > 0)
{
retVal->PTY = pipe; retVal->PTY = pipe;
retVal->stdIn = ILibProcessPipe_Pipe_CreateFromExistingWithExtraMemory(pipeManager, pipe, extraMemorySize); retVal->stdIn = ILibProcessPipe_Pipe_CreateFromExistingWithExtraMemory(pipeManager, pipe, extraMemorySize);
retVal->stdOut = ILibProcessPipe_Pipe_CreateFromExistingWithExtraMemory(pipeManager, pipe, extraMemorySize); retVal->stdOut = ILibProcessPipe_Pipe_CreateFromExistingWithExtraMemory(pipeManager, pipe, extraMemorySize);
@@ -963,6 +965,7 @@ ILibProcessPipe_Process ILibProcessPipe_Manager_SpawnProcessEx4(ILibProcessPipe_
ILibProcessPipe_Pipe_SetBrokenPipeHandler(retVal->stdOut, ILibProcessPipe_Process_BrokenPipeSink); ILibProcessPipe_Pipe_SetBrokenPipeHandler(retVal->stdOut, ILibProcessPipe_Process_BrokenPipeSink);
retVal->stdOut->mProcess = retVal; retVal->stdOut->mProcess = retVal;
} }
}
else else
{ {
if (spawnType != ILibProcessPipe_SpawnTypes_DETACHED) if (spawnType != ILibProcessPipe_SpawnTypes_DETACHED)