diff --git a/CHANGELOG.md b/CHANGELOG.md index 9acc98bbc..4e8d7a030 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ We use [semantic versioning](http://semver.org/): - PATCH version when you make backwards compatible bug fixes. # Next version +- [fix] _agent_: In some cases the hostname was wrongly added to the PID when sending it to Teamscale. # 37.0.1 - [fix] _agent_: Changed testwise coverage mode to log a warning and finalize an interrupted test as `SKIPPED` (with a calculated duration) if a new test started before the previous `/test/end` event arrived. diff --git a/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt b/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt index 4ad524ce7..a9e2155da 100644 --- a/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt +++ b/agent/src/main/kotlin/com/teamscale/jacoco/agent/configuration/ProcessInformationRetriever.kt @@ -50,7 +50,9 @@ class ProcessInformationRetriever(private val logger: ILogger) { val pid = processHandleClass.getMethod("pid").invoke(processHandle) as Long return pid.toString() } catch (_: ReflectiveOperationException) { - return ManagementFactory.getRuntimeMXBean().name + // getRunTimeMXBean().name returns 'pid@hostname' + val res = ManagementFactory.getRuntimeMXBean().name + return res.substringBefore('@') } } }