diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2012-05-23 14:57:19 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-05-23 15:32:42 -0500 |
commit | 478fa4a9694ee379c13d1d17710e2c419b5bd7af (patch) | |
tree | 51841731e2faa1601646334987c8d079d7f93a65 | |
parent | 2e744dbf64ed5a1b987508ba5f4445357d2feac6 (diff) | |
download | craftbukkit-478fa4a9694ee379c13d1d17710e2c419b5bd7af.tar craftbukkit-478fa4a9694ee379c13d1d17710e2c419b5bd7af.tar.gz craftbukkit-478fa4a9694ee379c13d1d17710e2c419b5bd7af.tar.lz craftbukkit-478fa4a9694ee379c13d1d17710e2c419b5bd7af.tar.xz craftbukkit-478fa4a9694ee379c13d1d17710e2c419b5bd7af.zip |
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.
-rw-r--r-- | src/main/java/jline/internal/TerminalLineSettings.java | 18 |
1 files changed, 13 insertions, 5 deletions
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 } /** |