@@ -7,6 +7,7 @@ import { IDisposable } from '../types';
7
7
import { EnvironmentVariables } from '../variables/types' ;
8
8
import { execObservable , killPid , plainExec , shellExec } from './rawProcessApis' ;
9
9
import { ExecutionResult , IProcessService , ObservableExecutionResult , ShellOptions , SpawnOptions } from './types' ;
10
+ import { workerPlainExec , workerShellExec } from './worker/rawProcessApiWrapper' ;
10
11
11
12
export class ProcessService extends EventEmitter implements IProcessService {
12
13
private processesToKill = new Set < IDisposable > ( ) ;
@@ -47,14 +48,20 @@ export class ProcessService extends EventEmitter implements IProcessService {
47
48
}
48
49
49
50
public exec ( file : string , args : string [ ] , options : SpawnOptions = { } ) : Promise < ExecutionResult < string > > {
51
+ this . emit ( 'exec' , file , args , options ) ;
52
+ if ( options . useWorker ) {
53
+ return workerPlainExec ( file , args , options ) ;
54
+ }
50
55
const execOptions = { ...options , doNotLog : true } ;
51
56
const promise = plainExec ( file , args , execOptions , this . env , this . processesToKill ) ;
52
- this . emit ( 'exec' , file , args , options ) ;
53
57
return promise ;
54
58
}
55
59
56
60
public shellExec ( command : string , options : ShellOptions = { } ) : Promise < ExecutionResult < string > > {
57
61
this . emit ( 'exec' , command , undefined , options ) ;
62
+ if ( options . useWorker ) {
63
+ return workerShellExec ( command , options ) ;
64
+ }
58
65
const disposables = new Set < IDisposable > ( ) ;
59
66
const shellOptions = { ...options , doNotLog : true } ;
60
67
return shellExec ( command , shellOptions , this . env , disposables ) . finally ( ( ) => {
0 commit comments