From 478fa4a9694ee379c13d1d17710e2c419b5bd7af Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Wed, 23 May 2012 14:57:19 -0500 Subject: 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. --- src/main/java/jline/internal/TerminalLineSettings.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/main/java/jline') diff --git a/src/main/java/jline/internal/TerminalLineSettings.java b/src/main/java/jline/internal/TerminalLineSettings.java index d5731ca4..b4b2409e 100644 --- a/src/main/java/jline/internal/TerminalLineSettings.java +++ b/src/main/java/jline/internal/TerminalLineSettings.java @@ -83,17 +83,25 @@ public final class TerminalLineSettings */ public int getProperty(String name) { assert name != null; + // CraftBukkit start + long currentTime = System.currentTimeMillis(); + try { // 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"); - configLastFetched = System.currentTimeMillis(); } - return this.getProperty(name, config); } catch (Exception e) { - Log.warn("Failed to query stty ", name, e); - return -1; + Log.debug("Failed to query stty ", name, "\n", e); } + + // 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 } /** -- cgit v1.2.3