sdlGetProcessOutput function

Pointer<SdlIoStream> sdlGetProcessOutput(
  1. Pointer<SdlProcess> process
)

Get the SDL_IOStream associated with process standard output.

The process must have been created with SDL_CreateProcess() and pipe_stdio set to true, or with SDL_CreateProcessWithProperties() and SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER set to SDL_PROCESS_STDIO_APP.

Reading from this stream can return 0 with SDL_GetIOStatus() returning SDL_IO_STATUS_NOT_READY if no output is available yet.

\param process The process to get the output stream for. \returns the output stream or NULL on failure; call SDL_GetError() for more information.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.1.3.

\sa SDL_CreateProcess \sa SDL_CreateProcessWithProperties \sa SDL_GetProcessInput

extern SDL_DECLSPEC SDL_IOStream *SDLCALL SDL_GetProcessOutput(SDL_Process *process)

Implementation

Pointer<SdlIoStream> sdlGetProcessOutput(Pointer<SdlProcess> process) {
  final sdlGetProcessOutputLookupFunction = libSdl3.lookupFunction<
      Pointer<SdlIoStream> Function(Pointer<SdlProcess> process),
      Pointer<SdlIoStream> Function(
          Pointer<SdlProcess> process)>('SDL_GetProcessOutput');
  return sdlGetProcessOutputLookupFunction(process);
}