We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8ef722e commit 7edd529Copy full SHA for 7edd529
common/src/main/java/com/taobao/arthas/common/PidUtils.java
@@ -28,7 +28,11 @@ public class PidUtils {
28
}
29
30
try {
31
- MAIN_CLASS = System.getProperty("sun.java.command", "");
+ String command = System.getProperty("sun.java.command", "");
32
+ // sun.java.command contains the main class name followed by its arguments,
33
+ // so only take the first token as the main class name
34
+ int spaceIndex = command.indexOf(' ');
35
+ MAIN_CLASS = spaceIndex != -1 ? command.substring(0, spaceIndex) : command;
36
} catch (Throwable e) {
37
// ignore
38
0 commit comments