@@ -5,21 +5,13 @@ import * as fsapi from 'fs-extra';
5
5
import * as path from 'path' ;
6
6
import * as vscode from 'vscode' ;
7
7
import { IWorkspaceService } from '../../common/application/types' ;
8
- import {
9
- ExecutionResult ,
10
- IProcessLogger ,
11
- IProcessServiceFactory ,
12
- ShellOptions ,
13
- SpawnOptions ,
14
- } from '../../common/process/types' ;
8
+ import { ExecutionResult , IProcessServiceFactory , ShellOptions , SpawnOptions } from '../../common/process/types' ;
15
9
import { IDisposable , IConfigurationService , IExperimentService } from '../../common/types' ;
16
10
import { chain , iterable } from '../../common/utils/async' ;
17
11
import { getOSType , OSType } from '../../common/utils/platform' ;
18
12
import { IServiceContainer } from '../../ioc/types' ;
19
13
import { traceError , traceVerbose } from '../../logging' ;
20
14
import { DiscoveryUsingWorkers } from '../../common/experiments/groups' ;
21
- import { workerPlainExec , workerShellExec } from '../../common/process/worker/rawProcessApiWrapper' ;
22
- import { IEnvironmentVariablesProvider } from '../../common/variables/types' ;
23
15
24
16
let internalServiceContainer : IServiceContainer ;
25
17
export function initializeExternalDependencies ( serviceContainer : IServiceContainer ) : void {
@@ -29,32 +21,21 @@ export function initializeExternalDependencies(serviceContainer: IServiceContain
29
21
// processes
30
22
31
23
export async function shellExecute ( command : string , options : ShellOptions = { } ) : Promise < ExecutionResult < string > > {
32
- if ( ! inExperiment ( DiscoveryUsingWorkers . experiment ) ) {
33
- const service = await internalServiceContainer . get < IProcessServiceFactory > ( IProcessServiceFactory ) . create ( ) ;
34
- return service . shellExec ( command , options ) ;
35
- }
36
- const logger = internalServiceContainer . get < IProcessLogger > ( IProcessLogger ) ;
37
- const envVarsService = internalServiceContainer . get < IEnvironmentVariablesProvider > ( IEnvironmentVariablesProvider ) ;
38
- const envs = await envVarsService . getEnvironmentVariables ( ) ;
39
- options . env = { ...options . env , ...envs } ;
40
- return workerShellExec ( command , options , logger ) ;
24
+ const useWorker = inExperiment ( DiscoveryUsingWorkers . experiment ) ;
25
+ const service = await internalServiceContainer . get < IProcessServiceFactory > ( IProcessServiceFactory ) . create ( ) ;
26
+ options = { ...options , useWorker } ;
27
+ return service . shellExec ( command , options ) ;
41
28
}
42
29
43
30
export async function exec (
44
31
file : string ,
45
32
args : string [ ] ,
46
33
options : SpawnOptions = { } ,
47
- useWorkerThreads = inExperiment ( DiscoveryUsingWorkers . experiment ) ,
34
+ useWorker = inExperiment ( DiscoveryUsingWorkers . experiment ) ,
48
35
) : Promise < ExecutionResult < string > > {
49
- if ( ! useWorkerThreads ) {
50
- const service = await internalServiceContainer . get < IProcessServiceFactory > ( IProcessServiceFactory ) . create ( ) ;
51
- return service . exec ( file , args , options ) ;
52
- }
53
- const logger = internalServiceContainer . get < IProcessLogger > ( IProcessLogger ) ;
54
- const envVarsService = internalServiceContainer . get < IEnvironmentVariablesProvider > ( IEnvironmentVariablesProvider ) ;
55
- const envs = await envVarsService . getEnvironmentVariables ( ) ;
56
- options . env = { ...options . env , ...envs } ;
57
- return workerPlainExec ( file , args , options , logger ) ;
36
+ const service = await internalServiceContainer . get < IProcessServiceFactory > ( IProcessServiceFactory ) . create ( ) ;
37
+ options = { ...options , useWorker } ;
38
+ return service . exec ( file , args , options ) ;
58
39
}
59
40
60
41
export function inExperiment ( experimentName : string ) : boolean {
0 commit comments