sdlCreateProcess function
Create a new process.
The path to the executable is supplied in args0
. args1..N
are
additional arguments passed on the command line of the new process, and the
argument list should be terminated with a NULL, e.g.:
const char *args[] = { "myprogram", "argument", NULL };
Setting pipe_stdio to true is equivalent to setting
SDL_PROP_PROCESS_CREATE_STDIN_NUMBER
and
SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER
to SDL_PROCESS_STDIO_APP
, and
will allow the use of SDL_ReadProcess() or SDL_GetProcessInput() and
SDL_GetProcessOutput().
See SDL_CreateProcessWithProperties() for more details.
\param args the path and arguments for the new process. \param pipe_stdio true to create pipes to the process's standard input and from the process's standard output, false for the process to have no input and inherit the application's standard output. \returns the newly created and running process, or NULL if the process couldn't be created.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL 3.1.3.
\sa SDL_CreateProcessWithProperties \sa SDL_GetProcessProperties \sa SDL_ReadProcess \sa SDL_GetProcessInput \sa SDL_GetProcessOutput \sa SDL_KillProcess \sa SDL_WaitProcess \sa SDL_DestroyProcess
extern SDL_DECLSPEC SDL_Process *SDLCALL SDL_CreateProcess(const char * const *args, bool pipe_stdio)
Implementation
Pointer<SdlProcess> sdlCreateProcess(
Pointer<Pointer<Int8>> args, bool pipeStdio) {
final sdlCreateProcessLookupFunction = libSdl3.lookupFunction<
Pointer<SdlProcess> Function(
Pointer<Pointer<Int8>> args, Uint8 pipeStdio),
Pointer<SdlProcess> Function(
Pointer<Pointer<Int8>> args, int pipeStdio)>('SDL_CreateProcess');
return sdlCreateProcessLookupFunction(args, pipeStdio ? 1 : 0);
}