Open 05nelsonm opened 4 months ago
And like that, the error presents itself in CI (even with the above "fix") https://github.com/05nelsonm/kmp-process/actions/runs/9316330728/job/25644357709#step:9:360
This is either an iOS
, or an x86_64
simulator thing...
Seems to be an issue related to spawning the process from a background thread? Maybe advantageous for native to investigate using runBlocking
+ Dispatchers.Main
???
Getting errors on
iOS
sometimes wherestdout
has no output and the program does nothing (either a zombie process, or something is inhibiting it from further execution).iOS
usesposix_spawn
exclusively which is why I think there is a race condition going on between the process spawning, and when descriptors are closed for the unused pipe ends in the parent process.NOTE: It'd be "safe" to leave the unused ends of the pipes open in the parent because
CLOEXEC
is set.Because
posix_spawn
is sort of a black box, this is incredibly difficult to test, but my hunch is that it's attributed to the almost immediate closure of those unused pipe ends which may not have been dup'd yet in the child.