Module process

Available on crate feature dep_sdl3 only.
Expand description

Process control support.

These functions provide a cross-platform way to spawn and manage OS-level processes.

You can create a new subprocess with SDL_CreateProcess() and optionally read and write to it using SDL_ReadProcess() or SDL_GetProcessInput() and SDL_GetProcessOutput(). If more advanced functionality like chaining input between processes is necessary, you can use SDL_CreateProcessWithProperties().

You can get the status of a created process with SDL_WaitProcess(), or terminate the process with SDL_KillProcess().

Don’t forget to call SDL_DestroyProcess() to clean up, whether the process process was killed, terminated on its own, or is still running!

Structs§

SDL_Process
An opaque handle representing a system process.
SDL_ProcessIO
Description of where standard I/O should be directed when creating a process.

Constants§

SDL_PROCESS_STDIO_APP
The I/O stream is connected to a new SDL_IOStream that the application can read or write
SDL_PROCESS_STDIO_INHERITED
The I/O stream is inherited from the application.
SDL_PROCESS_STDIO_NULL
The I/O stream is ignored.
SDL_PROCESS_STDIO_REDIRECT
The I/O stream is redirected to an existing SDL_IOStream.
SDL_PROP_PROCESS_BACKGROUND_BOOLEAN
SDL_PROP_PROCESS_CREATE_ARGS_POINTER
SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN
SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER
SDL_PROP_PROCESS_CREATE_STDERR_NUMBER
SDL_PROP_PROCESS_CREATE_STDERR_POINTER
SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN
SDL_PROP_PROCESS_CREATE_STDIN_NUMBER
SDL_PROP_PROCESS_CREATE_STDIN_POINTER
SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER
SDL_PROP_PROCESS_CREATE_STDOUT_POINTER
SDL_PROP_PROCESS_PID_NUMBER
SDL_PROP_PROCESS_STDERR_POINTER
SDL_PROP_PROCESS_STDIN_POINTER
SDL_PROP_PROCESS_STDOUT_POINTER

Functions§

SDL_CreateProcess
Create a new process.
SDL_CreateProcessWithProperties
Create a new process with the specified properties.
SDL_DestroyProcess
Destroy a previously created process object.
SDL_GetProcessInput
Get the SDL_IOStream associated with process standard input.
SDL_GetProcessOutput
Get the SDL_IOStream associated with process standard output.
SDL_GetProcessProperties
Get the properties associated with a process.
SDL_KillProcess
Stop a process.
SDL_ReadProcess
Read all the output from a process.
SDL_WaitProcess
Wait for a process to finish.