PY-88045 Do not drop old exe for targets with run tool

This option was an experiment (mostly for "uv run") when we tried to use
interpreterPath in SDK as a path to uv, but it was dropped later on, so
this parameter should've been dropped as well, but it wasn't.


(cherry picked from commit 0226eb031c7e0c69c35c19581e915bd13d4fc3c9)

IJ-MR-194626

GitOrigin-RevId: 61a8046caa1a522be5e4a278e3d41541dd27213c
This commit is contained in:
Alexey Katsman
2026-03-04 21:26:00 +00:00
committed by intellij-monorepo-bot
parent 3018a8c5aa
commit 05b8bdbbb1
3 changed files with 2 additions and 5 deletions
@@ -16,7 +16,6 @@ import com.intellij.execution.target.TargetEnvironmentRequest
import com.intellij.execution.target.TargetPlatform
import com.intellij.execution.target.TargetedCommandLine
import com.intellij.execution.target.TargetedCommandLineBuilder
import com.intellij.execution.target.getTargetPaths
import com.intellij.execution.target.local.LocalTargetPtyOptions
import com.intellij.execution.target.value.TargetEnvironmentFunction
import com.intellij.execution.target.value.TargetValue
@@ -137,7 +136,7 @@ private fun applyRunToolAsync(
.onSuccess { originalExe: String? ->
commandLineBuilder.exePath = TargetValue.fixed(runTool.exe)
commandLineBuilder.addFixedParametersAt(0, runTool.args)
if (!runTool.dropOldExe && originalExe != null) {
if (originalExe != null) {
commandLineBuilder.addParameterAt(runTool.args.size, originalExe)
}
}
@@ -44,14 +44,12 @@ data class PyRunToolData(
* @property exe The path to the Python executable or script.
* @property args A list of arguments to be passed to the executable.
* @property envs A map of environment variables to be used during execution.
* @property dropOldExe Since we replace the original exe with a new one, we can drop the old executable altogether with this flag.
*/
@ApiStatus.Internal
data class PyRunToolParameters(
val exe: String,
val args: List<String>,
val envs: Map<String, String>,
val dropOldExe: Boolean,
)
/**
@@ -28,7 +28,7 @@ internal class UvRunToolProvider : PyRunToolProvider {
env += "VIRTUAL_ENV" to it
env += "UV_PROJECT_ENVIRONMENT" to it
}
return PyRunToolParameters(requireNotNull(uvExecutable) { "Unable to find uv executable." }, listOf("run"), env, dropOldExe = true)
return PyRunToolParameters(requireNotNull(uvExecutable) { "Unable to find uv executable." }, listOf("run"), env)
}
override val runToolData: PyRunToolData = PyRunToolData(