@@ -44,7 +44,6 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/
44
44
import { Schemas } from 'vs/base/common/network' ;
45
45
import { IPanelService } from 'vs/workbench/services/panel/common/panelService' ;
46
46
import { IPathService } from 'vs/workbench/services/path/common/pathService' ;
47
- import { env as processEnv , cwd as processCwd } from 'vs/base/common/process' ;
48
47
import { IViewsService , IViewDescriptorService , ViewContainerLocation } from 'vs/workbench/common/views' ;
49
48
import { ILogService } from 'vs/platform/log/common/log' ;
50
49
import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
@@ -540,7 +539,7 @@ export class TerminalTaskSystem implements ITaskSystem {
540
539
const paths = envPath ? envPath . split ( path . delimiter ) . map ( p => this . configurationResolverService . resolve ( workspaceFolder , p ) ) : undefined ;
541
540
let foundExecutable = await systemInfo ?. findExecutable ( command , cwd , paths ) ;
542
541
if ( ! foundExecutable ) {
543
- foundExecutable = await this . findExecutable ( command , cwd , paths ) ;
542
+ foundExecutable = path . join ( cwd ?? '' , command ) ;
544
543
}
545
544
return foundExecutable ;
546
545
}
@@ -1602,59 +1601,4 @@ export class TerminalTaskSystem implements ITaskSystem {
1602
1601
outputChannel . append ( output ) ;
1603
1602
}
1604
1603
}
1605
-
1606
- private async fileExists ( path : string ) : Promise < boolean > {
1607
- const uri : URI = resources . toLocalResource ( URI . from ( { scheme : Schemas . file , path : path } ) , this . environmentService . remoteAuthority , this . pathService . defaultUriScheme ) ;
1608
- if ( await this . fileService . exists ( uri ) ) {
1609
- return ! ( ( await this . fileService . resolve ( uri ) ) . isDirectory ) ;
1610
- }
1611
- return false ;
1612
- }
1613
-
1614
- private async findExecutable ( command : string , cwd ?: string , paths ?: string [ ] ) : Promise < string > {
1615
- // If we have an absolute path then we take it.
1616
- if ( path . isAbsolute ( command ) ) {
1617
- return command ;
1618
- }
1619
- if ( cwd === undefined ) {
1620
- cwd = processCwd ( ) ;
1621
- }
1622
- const dir = path . dirname ( command ) ;
1623
- if ( dir !== '.' ) {
1624
- // We have a directory and the directory is relative (see above). Make the path absolute
1625
- // to the current working directory.
1626
- return path . join ( cwd , command ) ;
1627
- }
1628
- if ( paths === undefined && Types . isString ( processEnv . PATH ) ) {
1629
- paths = processEnv . PATH . split ( path . delimiter ) ;
1630
- }
1631
- // No PATH environment. Make path absolute to the cwd.
1632
- if ( paths === undefined || paths . length === 0 ) {
1633
- return path . join ( cwd , command ) ;
1634
- }
1635
- // We have a simple file name. We get the path variable from the env
1636
- // and try to find the executable on the path.
1637
- for ( let pathEntry of paths ) {
1638
- // The path entry is absolute.
1639
- let fullPath : string ;
1640
- if ( path . isAbsolute ( pathEntry ) ) {
1641
- fullPath = path . join ( pathEntry , command ) ;
1642
- } else {
1643
- fullPath = path . join ( cwd , pathEntry , command ) ;
1644
- }
1645
-
1646
- if ( await this . fileExists ( fullPath ) ) {
1647
- return fullPath ;
1648
- }
1649
- let withExtension = fullPath + '.com' ;
1650
- if ( await this . fileExists ( withExtension ) ) {
1651
- return withExtension ;
1652
- }
1653
- withExtension = fullPath + '.exe' ;
1654
- if ( await this . fileExists ( withExtension ) ) {
1655
- return withExtension ;
1656
- }
1657
- }
1658
- return path . join ( cwd , command ) ;
1659
- }
1660
1604
}
0 commit comments