sdlWaitProcess function
Wait for a process to finish.
This can be called multiple times to get the status of a process.
The exit code will be the exit code of the process if it terminates normally, a negative signal if it terminated due to a signal, or -255 otherwise. It will not be changed if the process is still running.
If you create a process with standard output piped to the application
(pipe_stdio
being true) then you should read all of the process output
before calling SDL_WaitProcess(). If you don't do this the process might be
blocked indefinitely waiting for output to be read and SDL_WaitProcess()
will never return true;
\param process The process to wait for. \param block If true, block until the process finishes; otherwise, report on the process' status. \param exitcode a pointer filled in with the process exit code if the process has exited, may be NULL. \returns true if the process exited, false otherwise.
\threadsafety This function is not thread safe.
\since This function is available since SDL 3.1.3.
\sa SDL_CreateProcess \sa SDL_CreateProcessWithProperties \sa SDL_KillProcess \sa SDL_DestroyProcess
extern SDL_DECLSPEC bool SDLCALL SDL_WaitProcess(SDL_Process *process, bool block, int *exitcode)
Implementation
bool sdlWaitProcess(
Pointer<SdlProcess> process, bool block, Pointer<Int32> exitcode) {
final sdlWaitProcessLookupFunction = libSdl3.lookupFunction<
Uint8 Function(
Pointer<SdlProcess> process, Uint8 block, Pointer<Int32> exitcode),
int Function(Pointer<SdlProcess> process, int block,
Pointer<Int32> exitcode)>('SDL_WaitProcess');
return sdlWaitProcessLookupFunction(process, block ? 1 : 0, exitcode) == 1;
}