Commit Graph

24 Commits

Author SHA1 Message Date
Sam Lantinga
afee27a530 Make sure stdio handles are in blocking mode
Standard I/O doesn't work well with non-blocking handles, so make sure any pipes are in blocking mode before launching child processes.

Fixes https://github.com/libsdl-org/SDL/issues/10998
2024-10-14 22:10:49 -07:00
Sam Lantinga
00385951a1 Use file descriptor I/O for process pipes
Use low level non-blocking I/O for process pipe streams. This may fix issues with data not getting through the pipe occasionally.

Related: https://github.com/libsdl-org/SDL/issues/11006
2024-10-04 12:24:17 -07:00
Sam Lantinga
3b3c4a79b6 Don't close file descriptors already handled by AddFileDescriptorCloseActions()
Fixes https://github.com/libsdl-org/SDL/issues/10997
2024-10-01 09:32:14 -07:00
Anonymous Maarten
f6055432c8 Fix null-pointer dereference on failing SDL_SYS_CreateProcess 2024-09-30 03:03:33 +02:00
Anonymous Maarten
e9bfa5bf6a Mitigate BatBadBut vulnerability 2024-09-30 03:03:33 +02:00
Sam Lantinga
481203c074 Fixed Xcode warnings 2024-09-18 13:20:53 -07:00
Sam Lantinga
a90ad3b0e2 Removed SDL_bool in favor of plain bool
We require stdbool.h in the build environment, so we might as well use the plain bool type.

If your environment doesn't have stdbool.h, this simple replacement will suffice:
typedef signed char bool;
2024-09-18 08:32:30 -07:00
Sam Lantinga
98cd8b34a7 Close the other file descriptors after redirection has taken place
Fixes https://github.com/libsdl-org/SDL/issues/10868
2024-09-17 07:46:48 -07:00
Sam Lantinga
718845a33d Fixed warning C4701: potentially uninitialized local variable 'startup_info' used 2024-09-15 09:21:04 -07:00
Sam Lantinga
604d0c519e If posix_spawn() is available, so is sigaction 2024-09-14 22:54:18 -07:00
Sam Lantinga
ec5d280c90 Make sure we ignore SIGPIPE so we don't crash if we write when the pipe is closed 2024-09-14 22:15:18 -07:00
Sam Lantinga
34b2f4ffca Use non-blocking pipes for process I/O on Windows
Fixes https://github.com/libsdl-org/SDL/issues/10846
2024-09-14 21:16:35 -07:00
Anonymous Maarten
dd07cc8991 SDL_Process: WAIT_TIMEOUT means the process has not exited yet 2024-09-14 21:16:29 -07:00
Sam Lantinga
dcb2a8c2fe Use CreateProcessW() to handle non-ASCII file paths and arguments 2024-09-14 12:27:22 -07:00
Sam Lantinga
e97f636590 SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER is an SDL_Environment pointer 2024-09-14 12:27:22 -07:00
Sam Lantinga
e673479449 Removed SDL_WriteProcess()
This had the unfortunate side-effect of blocking if you tried to write too much. Instead you can use SDL_GetProcessInput() and handle SDL_IO_STATUS_NOT_READY as needed.

Fixes https://github.com/libsdl-org/SDL/issues/10834
2024-09-14 11:15:50 -07:00
ritalat
f6f49de134 Add convenience functions to get process IOStreams 2024-09-14 10:33:29 -07:00
Sam Lantinga
7ff015ceae Close file descriptors not used by the child process 2024-09-14 10:29:02 -07:00
Sam Lantinga
76c469910e Added SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN 2024-09-14 10:29:02 -07:00
Semphriss
27862907c6 Update src/process/windows/SDL_windowsprocess.c
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2024-09-13 22:15:56 -07:00
Semphriss
82b33a7d3f Update src/process/windows/SDL_windowsprocess.c
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2024-09-13 22:15:56 -07:00
Semphris
3cf54675bb Windows process: escape backslashes before quotes 2024-09-13 22:15:56 -07:00
Sam Lantinga
90e01040c5 Added thread-safe environment functions
Also marked the existing functions as unsafe, as they can cause crashes if used in multi-threaded applications.

As a bonus, since the new functions are hashtable based, hint environment lookups are much faster.
2024-09-13 22:14:54 -07:00
Semphris
9eea8234e6 Add SDL_Process subsystem 2024-09-13 15:19:32 -07:00