@@ -9,6 +9,7 @@ import { Disposable, Uri } from 'vscode';
99import { IWorkspaceService } from '../../common/application/types' ;
1010import '../../common/extensions' ;
1111import { IPlatformService } from '../../common/platform/types' ;
12+ import { IPythonExecutionFactory } from '../../common/process/types' ;
1213import { ITerminalService , ITerminalServiceFactory } from '../../common/terminal/types' ;
1314import { IConfigurationService , IDisposableRegistry } from '../../common/types' ;
1415import { buildPythonExecInfo , PythonExecInfo } from '../../pythonEnvironments/exec' ;
@@ -26,6 +27,7 @@ export class TerminalCodeExecutionProvider implements ICodeExecutionService {
2627 @inject ( IWorkspaceService ) protected readonly workspace : IWorkspaceService ,
2728 @inject ( IDisposableRegistry ) protected readonly disposables : Disposable [ ] ,
2829 @inject ( IPlatformService ) protected readonly platformService : IPlatformService ,
30+ @inject ( IPythonExecutionFactory ) private readonly pythonExecutionFactory : IPythonExecutionFactory ,
2931 ) { }
3032
3133 public async executeFile ( file : Uri ) {
@@ -61,11 +63,12 @@ export class TerminalCodeExecutionProvider implements ICodeExecutionService {
6163
6264 public async getExecutableInfo ( resource ?: Uri , args : string [ ] = [ ] ) : Promise < PythonExecInfo > {
6365 const pythonSettings = this . configurationService . getSettings ( resource ) ;
64- const command = this . platformService . isWindows
65- ? pythonSettings . pythonPath . replace ( / \\ / g, '/' )
66- : pythonSettings . pythonPath ;
66+ const executionFactory = await this . pythonExecutionFactory . create ( { resource, executeAsAProcess : false } ) ;
67+ const execInfo = executionFactory . getExecutionInfo ( ) ;
68+ const pythonArgs = execInfo . args ;
69+ const command = this . platformService . isWindows ? execInfo . command . replace ( / \\ / g, '/' ) : execInfo . command ;
6770 const launchArgs = pythonSettings . terminal . launchArgs ;
68- return buildPythonExecInfo ( command , [ ...launchArgs , ...args ] ) ;
71+ return buildPythonExecInfo ( command , [ ...pythonArgs , ... launchArgs , ...args ] ) ;
6972 }
7073
7174 // Overridden in subclasses, see djangoShellCodeExecution.ts
0 commit comments