4
4
import * as fsapi from 'fs-extra' ;
5
5
import * as path from 'path' ;
6
6
import * as vscode from 'vscode' ;
7
- import { ExecutionResult , ShellOptions , SpawnOptions } from '../../common/process/types' ;
7
+ import { ExecutionResult , IProcessServiceFactory , ShellOptions , SpawnOptions } from '../../common/process/types' ;
8
8
import { IExperimentService , IDisposable , IConfigurationService } from '../../common/types' ;
9
9
import { chain , iterable } from '../../common/utils/async' ;
10
10
import { normalizeFilename } from '../../common/utils/filesystem' ;
11
11
import { getOSType , OSType } from '../../common/utils/platform' ;
12
12
import { IServiceContainer } from '../../ioc/types' ;
13
- import { plainExec , shellExec } from '../../common/process/rawProcessApis' ;
14
- import { BufferDecoder } from '../../common/process/decoder' ;
15
13
16
14
let internalServiceContainer : IServiceContainer ;
17
15
export function initializeExternalDependencies ( serviceContainer : IServiceContainer ) : void {
@@ -20,39 +18,14 @@ export function initializeExternalDependencies(serviceContainer: IServiceContain
20
18
21
19
// processes
22
20
23
- /**
24
- * Specialized version of the more generic shellExecute function to use only in
25
- * cases where we don't need to pass custom environment variables read from env
26
- * files or execution options.
27
- *
28
- * Also ensures to kill the processes created after execution.
29
- */
30
21
export async function shellExecute ( command : string , options : ShellOptions = { } ) : Promise < ExecutionResult < string > > {
31
- const disposables = new Set < IDisposable > ( ) ;
32
- return shellExec ( command , options , undefined , disposables ) . finally ( ( ) => {
33
- // Ensure the process we started is cleaned up.
34
- disposables . forEach ( ( p ) => {
35
- try {
36
- p . dispose ( ) ;
37
- } catch {
38
- // ignore.
39
- }
40
- } ) ;
41
- } ) ;
22
+ const service = await internalServiceContainer . get < IProcessServiceFactory > ( IProcessServiceFactory ) . create ( ) ;
23
+ return service . shellExec ( command , options ) ;
42
24
}
43
25
44
- /**
45
- * Specialized version of the more generic exec function to use only in
46
- * cases where we don't need to pass custom environment variables read from
47
- * env files.
48
- */
49
- export async function exec (
50
- file : string ,
51
- args : string [ ] ,
52
- options : SpawnOptions = { } ,
53
- disposables ?: Set < IDisposable > ,
54
- ) : Promise < ExecutionResult < string > > {
55
- return plainExec ( file , args , options , new BufferDecoder ( ) , undefined , disposables ) ;
26
+ export async function exec ( file : string , args : string [ ] , options : SpawnOptions = { } ) : Promise < ExecutionResult < string > > {
27
+ const service = await internalServiceContainer . get < IProcessServiceFactory > ( IProcessServiceFactory ) . create ( ) ;
28
+ return service . exec ( file , args , options ) ;
56
29
}
57
30
58
31
// filesystem
0 commit comments