So the main problem is, that I can only get output programatically from SteamCmd when it terminates. The expected output would be:
Redirecting stderr to 'D:\User\Downloads\TF2Server\SteamCMD\logs\stderr.txt'
[ 0%] ElAęrhetAĹ frissAştAęsek keresAęse...
[----] TelepAştAęs hitelesAştAęse...
Steam Console Client (c) Valve Corporation
-- type 'quit' to exit --
Loading Steam3...[HTTP Remote Control] HTTP server listening on port 27037.
OK.
Connecting anonymously to Steam Public...Logged in OK
Waiting for license info...OK
Initial App state (0x4) installed
App state (0x20104) validating, progress: 0.00 (0 / 5380081225)
App state (0x20104) validating, progress: 0.99 (53119962 / 5380081225)
[...]
App state (0x20104) validating, progress: 92.92 (4999198384 / 5380081225)
App state (0x20104) validating, progress: 97.35 (5237711118 / 5380081225)
Success! App '232250' already up to date.
But it just redirect this text:
Steam Console Client (c) Valve Corporation
-- type 'quit' to exit --
Loading Steam3...OK.
Connecting anonymously to Steam Public...Logged in OK
Then when it terminates, coming the rest totally mixed:
Waiting for license info...OK
Initial App state (0x4) installed
App state (0x20104) validating, progress: 0.02 (1048576 / 5380081225)
App state (0x20104) validating, progress: 0.98 (52595346 / 5380081225)
[...]
App state (0x20104) validating, progress: 93.92 (5053012344 / 5380081225)
App state (0x20104) validating, progress: 98.00 (5272580703 / 5380081225)
Success! App '232250' already up to date.
[HTTP Remote Control] HTTP server listening on port 27037.
Redirecting stderr to 'D:\User\Downloads\TF2Server\SteamCMD\logs\stderr.txt'
[ 0%] ElĂ©rhetĹ‘ frissĂtĂ©sek keresĂ©se...
[----] TelepĂtĂ©s hitelesĂtĂ©se...
So I googled for the solution a lot, then I found this issue: "https://github.com/ValveSoftware/Source-1-Games/issues/1684"
It says, that adding this to the code may solve the problem:
setvbuf(stdout, (char *)NULL, _IOLBF, 0);
How can I do this in c#?
This issue also refers to another (https://github.com/ValveSoftware/Source-1-Games/issues/352), saying:
When launching steamcmd.exe via the Windows CreateProcess() function, weird behavior occurs and steamcmd.exe spawns itself over and over.
Is there any way I can catch those processes and/or their outputs? Or any other ideas?