@@ -41,11 +41,14 @@ public CommandResult Execute(Action<Process>? processStarted)
4141
4242 _process . EnableRaisingEvents = true ;
4343
44- #if DEBUG
45- var sw = Stopwatch . StartNew ( ) ;
44+ Stopwatch sw = null ;
45+ if ( CommandLoggingContext . IsVerbose )
46+ {
47+ sw = Stopwatch . StartNew ( ) ;
48+
49+ Reporter . Verbose . WriteLine ( $ "> { FormatProcessInfo ( _process . StartInfo ) } ". White ( ) ) ;
50+ }
4651
47- Reporter . Verbose . WriteLine ( $ "> { FormatProcessInfo ( _process . StartInfo ) } ". White ( ) ) ;
48- #endif
4952 using ( var reaper = new ProcessReaper ( _process ) )
5053 {
5154 _process . Start ( ) ;
@@ -69,21 +72,22 @@ public CommandResult Execute(Action<Process>? processStarted)
6972
7073 var exitCode = _process . ExitCode ;
7174
72- #if DEBUG
73- var message = string . Format (
74- LocalizableStrings . ProcessExitedWithCode ,
75- FormatProcessInfo ( _process . StartInfo ) ,
76- exitCode ,
77- sw . ElapsedMilliseconds ) ;
78- if ( exitCode == 0 )
79- {
80- Reporter . Verbose . WriteLine ( message . Green ( ) ) ;
81- }
82- else
75+ if ( CommandLoggingContext . IsVerbose )
8376 {
84- Reporter . Verbose . WriteLine ( message . Red ( ) . Bold ( ) ) ;
77+ var message = string . Format (
78+ LocalizableStrings . ProcessExitedWithCode ,
79+ FormatProcessInfo ( _process . StartInfo ) ,
80+ exitCode ,
81+ sw . ElapsedMilliseconds ) ;
82+ if ( exitCode == 0 )
83+ {
84+ Reporter . Verbose . WriteLine ( message . Green ( ) ) ;
85+ }
86+ else
87+ {
88+ Reporter . Verbose . WriteLine ( message . Red ( ) . Bold ( ) ) ;
89+ }
8590 }
86- #endif
8791
8892 return new CommandResult (
8993 _process . StartInfo ,
0 commit comments