fix arthas-boot error when have _JAVA_OPTIONS env. #970

pull/976/head
hengyunabc 5 years ago
parent b69203f029
commit 778ffa2577

@ -101,21 +101,28 @@ public class ProcessUtils {
List<String> lines = ExecutingCommand.runNative(command);
AnsiLog.debug("jps result: " + lines);
int currentPid = Integer.parseInt(PidUtils.currentPid());
for (String line : lines) {
String[] strings = line.trim().split("\\s+");
if (strings.length < 1) {
continue;
}
int pid = Integer.parseInt(strings[0]);
if (pid == currentPid) {
continue;
}
if (strings.length >= 2 && isJpsProcess(strings[1])) { // skip jps
continue;
}
try {
int pid = Integer.parseInt(strings[0]);
if (pid == currentPid) {
continue;
}
if (strings.length >= 2 && isJpsProcess(strings[1])) { // skip jps
continue;
}
result.put(pid, line);
result.put(pid, line);
} catch (Throwable e) {
// https://github.com/alibaba/arthas/issues/970
// ignore
}
}
return result;

Loading…
Cancel
Save