@@ -12,6 +12,8 @@ import { ExecutionResult, ObservableExecutionResult, Output, ShellOptions, Spawn
1212import { noop } from '../utils/misc' ;
1313import { decodeBuffer } from './decoder' ;
1414import { traceVerbose } from '../../logging' ;
15+ import { WorkspaceService } from '../application/workspace' ;
16+ import { ProcessLogger } from './logger' ;
1517
1618const PS_ERROR_SCREEN_BOGUS = / y o u r [ 0 - 9 ] + x [ 0 - 9 ] + s c r e e n s i z e i s b o g u s \. e x p e c t t r o u b l e / ;
1719
@@ -49,12 +51,16 @@ function getDefaultOptions<T extends ShellOptions | SpawnOptions>(options: T, de
4951
5052export function shellExec (
5153 command : string ,
52- options : ShellOptions = { } ,
54+ options : ShellOptions & { doNotLog ?: boolean } = { } ,
5355 defaultEnv ?: EnvironmentVariables ,
5456 disposables ?: Set < IDisposable > ,
5557) : Promise < ExecutionResult < string > > {
5658 const shellOptions = getDefaultOptions ( options , defaultEnv ) ;
5759 traceVerbose ( `Shell Exec: ${ command } with options: ${ JSON . stringify ( shellOptions , null , 4 ) } ` ) ;
60+ if ( ! options . doNotLog ) {
61+ const processLogger = new ProcessLogger ( new WorkspaceService ( ) ) ;
62+ processLogger . logProcess ( command , undefined , shellOptions ) ;
63+ }
5864 return new Promise ( ( resolve , reject ) => {
5965 // eslint-disable-next-line @typescript-eslint/no-explicit-any
6066 const callback = ( e : any , stdout : any , stderr : any ) => {
@@ -90,12 +96,16 @@ export function shellExec(
9096export function plainExec (
9197 file : string ,
9298 args : string [ ] ,
93- options : SpawnOptions = { } ,
99+ options : SpawnOptions & { doNotLog ?: boolean } = { } ,
94100 defaultEnv ?: EnvironmentVariables ,
95101 disposables ?: Set < IDisposable > ,
96102) : Promise < ExecutionResult < string > > {
97103 const spawnOptions = getDefaultOptions ( options , defaultEnv ) ;
98104 const encoding = spawnOptions . encoding ? spawnOptions . encoding : 'utf8' ;
105+ if ( ! options . doNotLog ) {
106+ const processLogger = new ProcessLogger ( new WorkspaceService ( ) ) ;
107+ processLogger . logProcess ( file , args , options ) ;
108+ }
99109 const proc = spawn ( file , args , spawnOptions ) ;
100110 // Listen to these errors (unhandled errors in streams tears down the process).
101111 // Errors will be bubbled up to the `error` event in `proc`, hence no need to log.
@@ -192,12 +202,16 @@ function removeCondaRunMarkers(out: string) {
192202export function execObservable (
193203 file : string ,
194204 args : string [ ] ,
195- options : SpawnOptions = { } ,
205+ options : SpawnOptions & { doNotLog ?: boolean } = { } ,
196206 defaultEnv ?: EnvironmentVariables ,
197207 disposables ?: Set < IDisposable > ,
198208) : ObservableExecutionResult < string > {
199209 const spawnOptions = getDefaultOptions ( options , defaultEnv ) ;
200210 const encoding = spawnOptions . encoding ? spawnOptions . encoding : 'utf8' ;
211+ if ( ! options . doNotLog ) {
212+ const processLogger = new ProcessLogger ( new WorkspaceService ( ) ) ;
213+ processLogger . logProcess ( file , args , options ) ;
214+ }
201215 const proc = spawn ( file , args , spawnOptions ) ;
202216 let procExited = false ;
203217 const disposable : IDisposable = {
0 commit comments