PyCharm tests: shutdown targets when process dies

GitOrigin-RevId: 7036b78a905017b418cecc8d16659bcdcdee4f9e
This commit is contained in:
Ilya.Kazakevich
2025-08-12 23:19:27 +02:00
committed by intellij-monorepo-bot
parent e25856ac25
commit c51f227a33

View File

@@ -52,7 +52,7 @@ internal suspend fun createProcessLauncherOnTarget(binOnTarget: BinOnTarget, lau
targetEnv.getTargetPaths(localFile.pathString).first()
}
val exePath: FullPathOnTarget
val cmdLine = TargetedCommandLineBuilder(request).also {commandLineBuilder ->
val cmdLine = TargetedCommandLineBuilder(request).also { commandLineBuilder ->
binOnTarget.configureTargetCmdLine(commandLineBuilder)
// exe path is always fixed (pre-presolved) promise. It can't be obtained directly because of Targets API limitation
exePath = commandLineBuilder.exePath.localValue.blockingGet(1000) ?: error("Exe path not set: $binOnTarget is broken")
@@ -87,7 +87,11 @@ private class TargetProcessCommands(
while (process?.isAlive == true) {
delay(100.milliseconds)
}
}, killProcess = { process?.destroyForcibly() })
targetEnv.shutdown()
}, killProcess = {
process?.destroyForcibly();
targetEnv.shutdown()
})
override suspend fun start(): Result<Process, ExecErrorReason.CantStart> {