cleanup [pycharm] PY-85897: Reformat files before MR

(cherry picked from commit bd17b487d3d7f61a2cc4585ce7e38256a2c43b51)

GitOrigin-RevId: a4b6b9aa58337e2f7fb31f9bd5f759708bca755f
This commit is contained in:
Ilya.Kazakevich
2026-03-25 21:21:21 +00:00
committed by intellij-monorepo-bot
parent 520b039d42
commit f37d8d50fa
2 changed files with 26 additions and 15 deletions
@@ -38,7 +38,10 @@ import kotlin.time.Duration.Companion.milliseconds
private val logger = fileLogger()
internal suspend fun createProcessLauncherOnTarget(binOnTarget: BinOnTarget, launchRequest: LaunchRequest): Result<ProcessLauncher, ExecuteGetProcessError.EnvironmentError> = withContext(Dispatchers.IO) {
internal suspend fun createProcessLauncherOnTarget(
binOnTarget: BinOnTarget,
launchRequest: LaunchRequest,
): Result<ProcessLauncher, ExecuteGetProcessError.EnvironmentError> = withContext(Dispatchers.IO) {
val target = binOnTarget.target
val request = if (target != null) {
@@ -115,7 +118,13 @@ internal suspend fun createProcessLauncherOnTarget(binOnTarget: BinOnTarget, lau
commandLineBuilder.addEnvironmentVariable(k, v)
}
}.build()
return@withContext Result.success(ProcessLauncher(exeForError = Exe.OnTarget(exePath), args = args, processCommands = TargetProcessCommands(launchRequest.scopeToBind, exePath, targetEnv, cmdLine, downloadConfig)))
return@withContext Result.success(ProcessLauncher(exeForError = Exe.OnTarget(exePath),
args = args,
processCommands = TargetProcessCommands(launchRequest.scopeToBind,
exePath,
targetEnv,
cmdLine,
downloadConfig)))
}
private class TargetProcessCommands(
@@ -134,16 +143,17 @@ private class TargetProcessCommands(
private var process: Process? = null
override val processFunctions: ProcessFunctions = ProcessFunctions(waitForExit = { // `waitForExit` seems to be broken in Targets API, hence polling
while (process?.isAlive == true) {
delay(100.milliseconds)
}
downloadAfterExecution()
targetEnv.shutdown()
}, killProcess = {
process?.destroyForcibly()
targetEnv.shutdown()
})
override val processFunctions: ProcessFunctions =
ProcessFunctions(waitForExit = { // `waitForExit` seems to be broken in Targets API, hence polling
while (process?.isAlive == true) {
delay(100.milliseconds)
}
downloadAfterExecution()
targetEnv.shutdown()
}, killProcess = {
process?.destroyForcibly()
targetEnv.shutdown()
})
private suspend fun downloadAfterExecution() {
if (downloadConfig == null) return
@@ -180,4 +190,5 @@ private class TargetProcessCommands(
}
}
private fun ExecutionException.asCantStart(): Result.Failure<ExecErrorReason.CantStart> = Result.failure(ExecErrorReason.CantStart(null, localizedMessage))
private fun ExecutionException.asCantStart(): Result.Failure<ExecErrorReason.CantStart> =
Result.failure(ExecErrorReason.CantStart(null, localizedMessage))
@@ -33,8 +33,8 @@ import kotlin.io.path.div
import kotlin.io.path.exists
import kotlin.io.path.setPosixFilePermissions
class PyTargetsSkeletonGenerator(skeletonPath: String, pySdk: Sdk, currentFolder: String?, project: Project?)
: PySkeletonGenerator(skeletonPath, pySdk, currentFolder) {
class PyTargetsSkeletonGenerator(skeletonPath: String, pySdk: Sdk, currentFolder: String?, project: Project?) :
PySkeletonGenerator(skeletonPath, pySdk, currentFolder) {
private val pyRequest: HelpersAwareTargetEnvironmentRequest = checkNotNull(
// TODO Get rid of the dependency on the default project
PythonInterpreterTargetEnvironmentFactory.findPythonTargetInterpreter(mySdk, project ?: ProjectManager.getInstance().defaultProject)