@@ -77,22 +77,30 @@ run_gcov <- function(path, quiet = TRUE, clean = TRUE,
77
77
if (length(gcov_inputs )) stop(' gcov not found' )
78
78
return ()
79
79
}
80
+
81
+ if (clean ) {
82
+ on.exit({
83
+ gcov_outputs <- list.files(path , pattern = rex :: rex(" .gcov" , end ), recursive = TRUE , full.names = TRUE )
84
+ unlink(gcov_outputs )
85
+ })
86
+ }
87
+
80
88
run_gcov_one <- function (src ) {
81
89
system_check(gcov_path ,
82
90
args = c(gcov_args , src , " -p" , " -o" , dirname(src )),
83
91
quiet = quiet , echo = ! quiet )
84
- gcov_outputs <- list.files(path , pattern = rex :: rex(" .gcov" , end ), recursive = TRUE , full.names = TRUE )
85
- if (clean ) {
86
- on.exit(unlink(gcov_outputs ))
87
- }
88
- unlist(lapply(gcov_outputs , parse_gcov , package_path = c(path , getOption(" covr.gcov_additional_paths" , NULL ))), recursive = FALSE )
89
92
}
90
93
91
- res <- withr :: with_dir(src_path , {
92
- compact(unlist(lapply(gcov_inputs , run_gcov_one ), recursive = FALSE ))
93
- })
94
- if (! length(res ) && length(gcov_inputs ))
94
+ withr :: with_dir(src_path , {
95
+ compact(unlist(lapply(gcov_inputs , run_gcov_one ), recursive = FALSE ))
96
+ gcov_outputs <- list.files(path , pattern = rex :: rex(" .gcov" , end ), recursive = TRUE , full.names = TRUE )
97
+ res <- unlist(lapply(gcov_outputs , parse_gcov , package_path = c(path , getOption(" covr.gcov_additional_paths" , NULL ))), recursive = FALSE )
98
+ })
99
+
100
+ if (! length(res ) && length(gcov_inputs )) {
95
101
warning(' parsed gcov output was empty' )
102
+ }
103
+
96
104
res
97
105
}
98
106
0 commit comments