@@ -708,14 +708,14 @@ export interface ProcessReturnType {
708708}
709709
710710export async function spawnChildProcess ( program : string , args : string [ ] = [ ] , continueOn ?: string , cancellationToken ?: vscode . CancellationToken ) : Promise < ProcessReturnType > {
711- const programOutput : ProcessOutput = await spawnChildProcessImpl ( program , args , continueOn , cancellationToken ) ;
712- const exitCode : number | NodeJS . Signals | undefined = programOutput . exitCode ;
713711 // Do not use CppSettings to avoid circular require()
714712 const settings : vscode . WorkspaceConfiguration = vscode . workspace . getConfiguration ( "C_Cpp" , null ) ;
715713 const loggingLevel : string | undefined = settings . get < string > ( "loggingLevel" ) ;
716714 if ( loggingLevel === "Information" || loggingLevel === "Debug" ) {
717- getOutputChannelLogger ( ) . appendLine ( `$ ${ program } ${ args . join ( ' ' ) } \n ${ programOutput . stderr || programOutput . stdout } \n ` ) ;
715+ getOutputChannelLogger ( ) . appendLine ( `$ ${ program } ${ args . join ( ' ' ) } ` ) ;
718716 }
717+ const programOutput : ProcessOutput = await spawnChildProcessImpl ( program , args , continueOn , cancellationToken ) ;
718+ const exitCode : number | NodeJS . Signals | undefined = programOutput . exitCode ;
719719 if ( programOutput . exitCode ) {
720720 return { succeeded : false , exitCode, output : programOutput . stderr || programOutput . stdout || localize ( 'process.exited' , 'Process exited with code {0}' , exitCode ) } ;
721721 } else {
@@ -738,6 +738,10 @@ interface ProcessOutput {
738738
739739async function spawnChildProcessImpl ( program : string , args : string [ ] , continueOn ?: string , cancellationToken ?: vscode . CancellationToken ) : Promise < ProcessOutput > {
740740 return new Promise ( async ( resolve , reject ) => {
741+ // Do not use CppSettings to avoid circular require()
742+ const settings : vscode . WorkspaceConfiguration = vscode . workspace . getConfiguration ( "C_Cpp" , null ) ;
743+ const loggingLevel : string | undefined = settings . get < string > ( "loggingLevel" ) ;
744+
741745 let proc : child_process . ChildProcess ;
742746 if ( await isExecutable ( program ) ) {
743747 proc = child_process . spawn ( `.${ isWindows ( ) ? '\\' : '/' } ${ path . basename ( program ) } ` , args , { shell : true , cwd : path . dirname ( program ) } ) ;
@@ -761,7 +765,11 @@ async function spawnChildProcessImpl(program: string, args: string[], continueOn
761765 let stderr : string = '' ;
762766 if ( proc . stdout ) {
763767 proc . stdout . on ( 'data' , data => {
764- stdout += data . toString ( ) ;
768+ const str : string = data . toString ( ) ;
769+ if ( loggingLevel !== "None" ) {
770+ getOutputChannelLogger ( ) . append ( str ) ;
771+ }
772+ stdout += str ;
765773 if ( continueOn ) {
766774 const continueOnReg : string = escapeStringForRegex ( continueOn ) ;
767775 if ( stdout . search ( continueOnReg ) ) {
0 commit comments