@@ -496,12 +496,15 @@ export class TerminalTaskSystem implements ITaskSystem {
496496 }
497497 }
498498
499- private resolveAndFindExecutable ( workspaceFolder : IWorkspaceFolder | undefined , task : CustomTask | ContributedTask , cwd : string | undefined , envPath : string | undefined ) : Promise < string > {
500- return this . findExecutable (
501- this . configurationResolverService . resolve ( workspaceFolder , CommandString . value ( task . command . name ! ) ) ,
502- cwd ? this . configurationResolverService . resolve ( workspaceFolder , cwd ) : undefined ,
503- envPath ? envPath . split ( path . delimiter ) . map ( p => this . configurationResolverService . resolve ( workspaceFolder , p ) ) : undefined
504- ) ;
499+ private async resolveAndFindExecutable ( systemInfo : TaskSystemInfo | undefined , workspaceFolder : IWorkspaceFolder | undefined , task : CustomTask | ContributedTask , cwd : string | undefined , envPath : string | undefined ) : Promise < string > {
500+ const command = this . configurationResolverService . resolve ( workspaceFolder , CommandString . value ( task . command . name ! ) ) ;
501+ cwd = cwd ? this . configurationResolverService . resolve ( workspaceFolder , cwd ) : undefined ;
502+ const paths = envPath ? envPath . split ( path . delimiter ) . map ( p => this . configurationResolverService . resolve ( workspaceFolder , p ) ) : undefined ;
503+ let foundExecutable = await systemInfo ?. findExecutable ( command , cwd , paths ) ;
504+ if ( ! foundExecutable ) {
505+ foundExecutable = await this . findExecutable ( command , cwd , paths ) ;
506+ }
507+ return foundExecutable ;
505508 }
506509
507510 private findUnresolvedVariables ( variables : Set < string > , alreadyResolved : Map < string , string > ) : Set < string > {
@@ -562,7 +565,7 @@ export class TerminalTaskSystem implements ITaskSystem {
562565 if ( isProcess ) {
563566 let process = CommandString . value ( task . command . name ! ) ;
564567 if ( taskSystemInfo . platform === Platform . Platform . Windows ) {
565- process = await this . resolveAndFindExecutable ( workspaceFolder , task , cwd , envPath ) ;
568+ process = await this . resolveAndFindExecutable ( taskSystemInfo , workspaceFolder , task , cwd , envPath ) ;
566569 }
567570 resolved . variables . set ( TerminalTaskSystem . ProcessVarName , process ) ;
568571 }
@@ -581,7 +584,7 @@ export class TerminalTaskSystem implements ITaskSystem {
581584 if ( isProcess ) {
582585 let processVarValue : string ;
583586 if ( Platform . isWindows ) {
584- processVarValue = await this . resolveAndFindExecutable ( workspaceFolder , task , cwd , envPath ) ;
587+ processVarValue = await this . resolveAndFindExecutable ( taskSystemInfo , workspaceFolder , task , cwd , envPath ) ;
585588 } else {
586589 processVarValue = this . configurationResolverService . resolve ( workspaceFolder , CommandString . value ( task . command . name ! ) ) ;
587590 }
0 commit comments