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
_______________________________________________
Ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

Reply via email to