We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7475f6f commit 77e0945Copy full SHA for 77e0945
src/main/kotlin/tech/httptoolkit/javaagent/AttachMain.kt
@@ -59,7 +59,13 @@ fun main(args: Array<String>) {
59
60
fun getOwnPid(): String {
61
// This should work in general, but it's implementation dependent:
62
- return ManagementFactory.getRuntimeMXBean().name.split("@")[0]
+ val pid = ManagementFactory.getRuntimeMXBean().name.split("@")[0]
63
+
64
+ return if (pid.toLongOrNull() != null) {
65
+ pid
66
+ } else {
67
+ ProcessHandle.current().pid().toString()
68
+ }
69
}
70
71
fun getTargets(): List<VirtualMachineDescriptor> {
0 commit comments