@@ -149,6 +149,22 @@ fn flushed_print(s string) {
149149 flush_stdout ()
150150}
151151
152+ fn (context &Context) verbose_command (cmd string ) {
153+ if context.verbose {
154+ println ('\n > ${cmd }' )
155+ }
156+ }
157+
158+ fn (context &Context) verbose_result (result os.Result) {
159+ if ! context.verbose {
160+ return
161+ }
162+ println (' exit code: ${result .exit_code }' )
163+ if result.output != '' {
164+ println (result.output.trim_right ('\r\n ' ))
165+ }
166+ }
167+
152168fn (mut context Context) clear_line () {
153169 if context.is_silent {
154170 return
@@ -207,9 +223,11 @@ fn (mut context Context) run() {
207223 if context.warmup > 0 {
208224 for i in 0 .. context.warmup {
209225 context.flushed_print ('${line_prefix }, warm up run: ${i + 1 :4 }/${context .warmup :- 4 }, took: ${f64 (duration ) / 1000 :6.1 f }ms ...' )
226+ context.verbose_command (cmd)
210227 mut sw := time.new_stopwatch ()
211228 res := os.execute (cmd)
212229 duration = i64 (sw.elapsed ().microseconds ())
230+ context.verbose_result (res)
213231 mut should_show_fail_output := false
214232 if res.exit_code != 0 && ! context.ignore_failed {
215233 if context.fail_count[cmd] == 0 {
@@ -226,9 +244,11 @@ fn (mut context Context) run() {
226244 }
227245 }
228246 for i in 0 .. context.run_count {
247+ context.verbose_command (cmd)
229248 mut sw := time.new_stopwatch ()
230249 res := os.execute (cmd)
231250 duration = i64 (sw.elapsed ().microseconds ())
251+ context.verbose_result (res)
232252 //
233253 mut should_show_fail_output := false
234254 if res.exit_code != 0 && ! context.ignore_failed {
@@ -443,7 +463,8 @@ fn (mut context Context) parse_options() ! {
443463 }
444464 context.show_output = fp.bool ('output' , `O` , false ,
445465 'Show command stdout/stderr in the progress indicator for each command. Note: slower, for verbose commands.' )
446- context.verbose = fp.bool ('verbose' , `v` , false , 'Be more verbose.' )
466+ context.verbose = fp.bool ('verbose' , `v` , false ,
467+ 'Print each command, its exit code, and its output.' )
447468 context.fail_on_maxtime = fp.int ('max_time' , `m` , max_time,
448469 'Fail with exit code 2, when first cmd takes above M milliseconds (regression). Default: ${max_time }' )
449470 context.fail_on_regress_percent = fp.int ('fail_percent' , `f` , max_fail_percent,
0 commit comments