Fix client spamming logs if program is launched via nohup

This commit is contained in:
Grische
2022-03-24 14:18:23 +00:00
committed by harlekin
parent aef9ccc034
commit 74d80b6acc

View File

@@ -20,6 +20,7 @@
package com.sheepit.client.standalone.text; package com.sheepit.client.standalone.text;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -48,8 +49,10 @@ public class CLIInputObserver implements Runnable {
try { try {
line = in.readLine(); line = in.readLine();
} }
catch (Exception e) { catch (IOException e) {
// TODO: handle exception // if the program has been launched into the background (e.g. with nohup), input is not valid
client.getLog().info("Unable to read user input, ignoring all further inputs");
break;
} }
for (CLIInputListener cliil : listeners) for (CLIInputListener cliil : listeners)
cliil.commandEntered(client, line); cliil.commandEntered(client, line);
@@ -59,7 +62,7 @@ public class CLIInputObserver implements Runnable {
} }
catch (Exception e) { catch (Exception e) {
// TODO: handle exception // TODO: handle exception
client.getLog().error("FIXME: Unhandled exception while closing InputStreamReader(): " + e);
} }
} }
} }