Minecraft-Console-Client
Minecraft-Console-Client copied to clipboard
[BUG] BasicIO still uses Console.KeyAvailable
Prerequisites
- [x] I made sure I am running the latest development build
- [x] I tried to look for similar issues before opening a new one
- [x] I have set
debugmessages=truein config to diagnose my issue - [x] I have redacted session tokens and passwords before attaching screenshots
Minecraft Version
1.16.5
Console Client Version
Latest
Expected Behavior
BasicIO mode should never throw
MCC] Unhandled exception. System.InvalidOperationException: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
Actual Behavior
BasicIO is supposed to set to interative mode, yet subprocess breaks. Following is the offending line
public static void HandleFailure(string? errorMessage = null, bool versionError = false, ChatBots.AutoRelog.DisconnectReason? disconnectReason = null)
{
if (!String.IsNullOrEmpty(errorMessage))
{
ConsoleIO.Reset();
HERE>>>>
while (Console.KeyAvailable)
Console.ReadKey(true);
ConsoleIO.WriteLine(errorMessage);
HandleFailure is called in multiple places but doesn't check for BasicIO.
Steps to Reproduce the bug
- Run MCC Client using python subprocess
- Reach any situation which calls HandleFailure (eg single dash arguments or server offline)
- Code tries to use Console.KeyAvailable and gives error
Attach screenshot here (If applicable)
No response
Anythings that could help diagnosing the bug
Device
None
Operating System
None
Server Address (If applicable)
No response
@breadbyte
Ah, I thought I got all the code paths that used raw console input instead of deferring to the ConsoleIO helper. I'll take a look at it