Skip to content

Commit d6e31bb

Browse files
fix: use run.executable instead of activatedRun.executable for interpreter identification
getInterpreterDetails, getSettingsPythonPath, and getExecutableCommand need the actual Python binary path, not the activated run command. Using activatedRun.executable breaks when environment managers set it to a wrapper command (e.g. pixi run ... python). This unblocks managers like conda and pixi from using wrapper commands in activatedRun without breaking the debugger, while remaining backwards-compatible since the two values are currently identical for all existing managers.
1 parent 6d06928 commit d6e31bb

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/extension/common/python.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export async function getSettingsPythonPath(resource?: Uri): Promise<string[] |
133133
return undefined;
134134
}
135135

136-
const runConfig = execInfo.activatedRun ?? execInfo.run;
136+
const runConfig = execInfo.run;
137137
traceLog(
138138
`getSettingsPythonPath: Using executable='${runConfig.executable}' args='${
139139
runConfig.args?.join(' ') || ''
@@ -255,9 +255,7 @@ export async function getInterpreterDetails(resource?: Uri): Promise<IInterprete
255255
const env: PythonEnvironment | undefined = await api.getEnvironment(resource);
256256
// resolve the environment to get full details
257257
const resolvedEnv = env ? await api.resolveEnvironment(env?.environmentPath) : undefined;
258-
const executablePath = resolvedEnv?.execInfo.activatedRun?.executable
259-
? resolvedEnv.execInfo.activatedRun.executable
260-
: resolvedEnv?.execInfo.run.executable;
258+
const executablePath = resolvedEnv?.execInfo.run.executable;
261259

262260
const a: IInterpreterDetails = {
263261
path: executablePath ? [executablePath] : undefined,

src/extension/debugger/adapter/factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac
193193
*/
194194
private async getExecutableCommand(interpreter: PythonEnvironment | undefined): Promise<string[]> {
195195
if (interpreter) {
196-
const executablePath = interpreter.execInfo.activatedRun?.executable ?? interpreter.execInfo.run.executable;
196+
const executablePath = interpreter.execInfo.run.executable;
197197
const version = interpreter.version;
198198

199199
// Parse version string (e.g., "3.8.10" -> major: 3, minor: 8)

0 commit comments

Comments
 (0)