Closed larsiusprime closed 10 years ago
As it turns out sys.io.Process actually spawns a Command Prompt window for a split second as it's doing its thing (at least on windows). I noticed this when my OS detection actually made the game go minimized on startup instead of full screen. I have also noticed that going fullscreen just as the game initialized the sound would make it lose its window handle and break the sound playback. If unlucky this might even cause crashes?
Might be worth looking into at least.
It was also a while since I did this, and looking at my code I was reading the output line by line, I seem to recall there was a reason I did it, it may also be worth investigating. Here's my code for that: https://gist.github.com/grapefrukt/8409089#file-windowsversion-hx-L27
If the process can produce a significant amount of data out stderr (say 1024 bytes), then the process can block writing to stderr, while you are blocking trying to read from stdout. The hxcpp build tool solves this by spawning a thread to read stderr, while the main thread reads stdout.
https://github.com/HaxeFoundation/hxcpp/blob/master/tools/run/ProcessManager.hx#L302
You could also maybe do something with a spin and non-blocking reads. But not sure this is the problem of nothing produces stderr.
I seem to remember this was solved a long time ago.
I'm getting reports from some users that the .bat files called by SystemData (on windows) are causing applications compiled with CrashDumper to crash on startup.
Ie, somewhere in here: https://github.com/larsiusprime/crashdumper/blob/master/crashdumper/SystemData.hx#L58
At first I thought it might be b/c the users were on different locales than me (French, Portuguese, etc), but the output seems to be the same, or at least have no effect. I had them copy/paste the batch file output and I entered it myself and could not reproduce.
I'm wondering if it's a more general problem with making sys.io.Process calls -- these are apparently somewhat dangerous commands that can have unexpected results that lead to the program hanging or crashing. Is there any way to wrap them "safely?" Try/catch blocks don't seem to do anything.