3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 21:10:17 +01:00

Remove "failed to querty stty columns" spam. Fixes BUKKIT-1669.

When trying to execute stty to get terminal properties an
InterruptedException can be triggered even though we've read all of the
output from stty that we need. Instead of printing a warning and returning
-1 in this case try to parse what data we do have and reset the cache timer.
May also address BUKKIT-1627 and BUKKIT-1686.
Dieser Commit ist enthalten in:
Travis Watkins 2012-05-23 14:57:19 -05:00
Ursprung 2e744dbf64
Commit 478fa4a969

Datei anzeigen

@ -83,17 +83,25 @@ public final class TerminalLineSettings
*/ */
public int getProperty(String name) { public int getProperty(String name) {
assert name != null; assert name != null;
// CraftBukkit start
long currentTime = System.currentTimeMillis();
try { try {
// tty properties are cached so we don't have to worry too much about getting term widht/height // tty properties are cached so we don't have to worry too much about getting term widht/height
if (config == null || System.currentTimeMillis() - configLastFetched > 1000 ) { if (config == null || currentTime - configLastFetched > 1000) {
config = get("-a"); config = get("-a");
configLastFetched = System.currentTimeMillis();
} }
return this.getProperty(name, config);
} catch (Exception e) { } catch (Exception e) {
Log.warn("Failed to query stty ", name, e); Log.debug("Failed to query stty ", name, "\n", e);
return -1;
} }
// always update the last fetched time and try to parse the output
if (currentTime - configLastFetched > 1000) {
configLastFetched = currentTime;
}
return this.getProperty(name, config);
// CraftBukkit end
} }
/** /**