Running From Console Ignores Input and Output Redirection
Opened this issue · 0 comments
airbreather commented
Repro Steps
- Create a file "bl.txt" containing just a single ASCII-encoded Windows newline.
- Run in a command prompt, or do the equivalent from a console application:
"BSAopt x64.exe" -criticals -skiphashcheck -processhidden -copy -game sk C:\Path\To\File.bsa C:\Path\To\Output <bl.txt >NUL 2>NUL
Expected
- No output is displayed on the command line, because it's redirected.
- The application should terminate because the process should have read the newline from the file.
Actual
- Console spam is still present.
- The application sticks around.
Workarounds
- I can sorta work around the console spam by spawning an entirely new instance of the command prompt to run the command to keep the original console's output clean, though with the Windows 10 console overhaul,
conhost.exe
wastes a perhaps surprising amount of CPU cycles when running several at once. - I can work around the "press enter" issue by prefixing the command line with
echo. |
.
I haven't yet figured out a way to work around both at once without resorting to running it through something like AutoHotkey.
Use Case
I kinda wanted to run BSAopt to extract BSA file content as part of an unattended Skyrim setup process, but neither spamming the original console nor forcing user input are acceptable, and making an AutoHotkey script just to work around both issues winds up being more annoying than just reimplementing the parts I care about in C#.