@@ -355,9 +355,7 @@ fn reduce_scope(content string, error_msg string, command string, do_fmt bool, f
355355 text_code = create_code (sc)
356356 os.write_file (rpdc_file_path, text_code) or { panic (err) }
357357 if do_fmt {
358- os.execute ('v fmt -w ${rpdc_file_path} ' )
359- final_content := os.read_file (rpdc_file_path) or { panic (err) }
360- show_code_stats (final_content, label: 'Code size after formatting' )
358+ vfmt_file (rpdc_file_path)
361359 }
362360 println ('The WIP reduced code is now in ${rpdc_file_path} ' )
363361 }
@@ -433,9 +431,7 @@ fn reduce_scope(content string, error_msg string, command string, do_fmt bool, f
433431 text_code = create_code (line_tree)
434432 os.write_file (rpdc_file_path, text_code) or { panic (err) }
435433 if do_fmt {
436- os.execute ('v fmt -w ${rpdc_file_path} ' )
437- final_content := os.read_file (rpdc_file_path) or { panic (err) }
438- show_code_stats (final_content, label: 'Code size after formatting' )
434+ vfmt_file (rpdc_file_path)
439435 }
440436 println ('The WIP reduced code is now in ${rpdc_file_path} ' )
441437 }
@@ -445,13 +441,17 @@ fn reduce_scope(content string, error_msg string, command string, do_fmt bool, f
445441 'string_reproduces' , @LOCATION)
446442 os.write_file (rpdc_file_path, text_code) or { panic (err) }
447443 if do_fmt {
448- os.execute ('v fmt -w ${rpdc_file_path} ' )
449- final_content := os.read_file (rpdc_file_path) or { panic (err) }
450- show_code_stats (final_content, label: 'Code size after formatting' )
444+ vfmt_file (rpdc_file_path)
451445 }
452446 println ('The reduced code is now in ${rpdc_file_path} ' )
453447}
454448
449+ fn vfmt_file (rpdc_file_path string ) {
450+ os.execute ('${os.quoted_path(@VEXE)} fmt -w ${rpdc_file_path} ' )
451+ final_content := os.read_file (rpdc_file_path) or { panic (err) }
452+ show_code_stats (final_content, label: 'Code size after formatting' )
453+ }
454+
455455@[params]
456456struct ShowParams {
457457 label string = 'Code size'
0 commit comments