merge two OSUtils

This commit is contained in:
hengyunabc committed 2018-11-09 16:09:23 +08:00
1 parent 551432da0a
commit 0ae53869be
4 files changed
+26 -24

No files matched your search

@@ -1,13 +0,0 @@
package com.taobao.arthas.client;
public class OSUtils {
public static boolean isWindowsOS() {
boolean isWindowsOS = false;
String osName = System.getProperty("os.name");
if (osName.toLowerCase().indexOf("windows") > -1) {
isWindowsOS = true;
}
return isWindowsOS;
}
}
@@ -17,6 +17,7 @@ import org.apache.commons.net.telnet.TelnetClient;
import org.apache.commons.net.telnet.TelnetOptionHandler;
import org.apache.commons.net.telnet.WindowSizeOptionHandler;
import com.taobao.arthas.common.OSUtils;
import com.taobao.middleware.cli.CLI;
import com.taobao.middleware.cli.CommandLine;
import com.taobao.middleware.cli.UsageMessageFormatter;
@@ -152,11 +153,8 @@ public class TelnetConsole {
public static void main(String[] args) throws IOException {
// support mingw/cygw jline color
if (System.getProperty("os.name").startsWith("Windows")) {
if ((System.getenv("MSYSTEM") != null && System.getenv("MSYSTEM").startsWith("MINGW"))
|| "/bin/shell".equals(System.getenv("SHELL"))) {
System.setProperty("jline.terminal", System.getProperty("jline.terminal", "jline.UnixTerminal"));
}
if (OSUtils.isCygwinOrMinGW()) {
System.setProperty("jline.terminal", System.getProperty("jline.terminal", "jline.UnixTerminal"));
}
TelnetConsole telnetConsole = new TelnetConsole();
@@ -220,7 +218,7 @@ public class TelnetConsole {
} else {
width = terminal.getWidth();
// hack for windows dos
if (OSUtils.isWindowsOS()) {
if (OSUtils.isWindows()) {
width--;
}
}