Subprocess standard output getting intercepted
etfre opened this issue ยท 2 comments
My speech recognition mod launches a Python process that communicates with C# through standard input/output streams. Somewhere between 3.11.0 and 3.12.0, the C# part of the mod stopped receiving stdout from the Python process, although it is still able to message back via stdin. I assume this is connected with LogManager and InterceptingTextWriter but I have not gotten much further than that, beyond trying to prefix all the Python messages with '\u200B', which allows messages through but in a garbled Unicode format.
The log is 3.12.0, but the issue also occurs in 3.12.8.
SMAPI intercepts stdin via Console.Out
as part of its normal features (e.g. to suppress or log the game's console output), so piggybacking on it to communicate with external processes is fragile and not really recommended. I suggest using something that's managed directly by your mod instead (maybe a named pipe between the C# mod and Python process?).
I'll close this since it's not really a SMAPI dev task, but feel free come join #making-mods on the Stardew Valley Discord if you want to discuss further!