[Ohrrpgce] [ohrrpgce/ohrrpgce] Test Game causes Custom to freeze on Unix if Game freezes / Cleanup process spawning (#22)

Ralph Versteegen notifications at github.com
Tue Aug 6 17:24:08 PDT 2019


The way we spawn Game on Unix (`open_process` with waitable=YES) is to use `popen` and `pclose`. Unfortunately `pclose` is synchronous, it will not return until the child process ends - so if it freezes, Custom will too. I've experienced this a lot.*
Spawning Game via gdb or valgame.sh also use `popen`. We don't use `popen`/`pclose` for anything else on Unix (`open_process` is also called with waitable=NO to spawn gifsicle).

popen/pclose is implemented on top of other standard Unix calls, but unfortunately doesn't provide a way to poll or kill the child. We can reimplement it ourselves to get that.
I've made a mess of the process spawning functions, there's a very confusing proliferation of different functions, quite a few of which are Unix- or Windows-specific or don't behave the same.

*One way is by using PRINT/? -- if using Test Game, text sent to stdout gets sent to the pipe created by popen, and since Custom never reads from that pipe, it eventually fills up, causing Game to freeze.

Since the whole point of `popen` is to create a pipe to the child, I guess that proves that we shouldn't be using `popen`.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/ohrrpgce/ohrrpgce/issues/22
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20190806/2d71377f/attachment.html>


More information about the Ohrrpgce mailing list