Skip to content

Commit 87d4236

Browse files
Use not so nice solution to fix crashing when backspacing in mono after having resized CLI window
1 parent 772f381 commit 87d4236

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

ServerCLI/Program.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,17 @@ static void Main( string[] args ) {
7878
Console.WriteLine( "** Server is now ready. Type /Shutdown to exit safely. **" );
7979

8080
while( !Server.IsShuttingDown ) {
81-
string cmd = Console.ReadLine();
81+
string cmd = null;
82+
try {
83+
cmd = Console.ReadLine();
84+
} catch (ArgumentException ex) {
85+
// ArgumentException is raised on Mono when you type a message into a large CLI window,
86+
// resize the CLI window to be smaller, and try to backspace when the message is biger
87+
// than the smaller resized CLI window
88+
Logger.Log(LogType.Error, "Error when reading input: " + ex);
89+
continue;
90+
}
91+
8292
if( cmd == null ) {
8393
Console.WriteLine(
8494
"*** Received EOF from console. You will not be able to type anything in console any longer. ***" );

0 commit comments

Comments
 (0)