mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 22:20:52 +00:00
Handle further linux terminal edge case
We handled a situation where linux terminal is closing STDIN durng interactive console. This handles even further edge case where linux terminal is closing STDIN during user masked input.
This commit is contained in:
@@ -314,9 +314,21 @@ internal static class Logging {
|
||||
|
||||
StringBuilder result = new();
|
||||
|
||||
ConsoleKeyInfo keyInfo;
|
||||
while (true) {
|
||||
ConsoleKeyInfo keyInfo = Console.ReadKey(true);
|
||||
|
||||
while ((keyInfo = Console.ReadKey(true)).Key != ConsoleKey.Enter) {
|
||||
switch (keyInfo.Key) {
|
||||
case 0:
|
||||
// Linux terminal closing STDIN, we're done here
|
||||
return result.ToString();
|
||||
case ConsoleKey.Enter:
|
||||
// User finishing input, as expected
|
||||
Console.WriteLine();
|
||||
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
// User continues input
|
||||
if (!char.IsControl(keyInfo.KeyChar)) {
|
||||
result.Append(keyInfo.KeyChar);
|
||||
Console.Write(mask);
|
||||
@@ -332,10 +344,6 @@ internal static class Logging {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
|
||||
return result.ToString();
|
||||
} finally {
|
||||
cts.Cancel();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user