builder: do not remove executables after run when -keepc is passed; add `-d trace_thirdparty_obj_files`

pull/7424/head
Delyan Angelov 2020-12-20 12:22:17 +02:00
parent b1f6ff8871
commit 4b45f2eaab
2 changed files with 7 additions and 1 deletions

View File

@ -836,7 +836,9 @@ fn (mut v Builder) build_thirdparty_obj_file(path string, moduleflags []cflag.CF
os.chdir(os.dir(pref.vexe_path()))
//
cmd := '$v.pref.ccompiler $cppoptions $v.pref.third_party_option $btarget -o "$opath" -c "$cfile" $atarget'
// eprintln('>>> cmd: $cmd')
$if trace_thirdparty_obj_files ? {
println('>>> build_thirdparty_obj_files cmd: $cmd')
}
res := os.exec(cmd) or {
eprintln('exec failed for thirdparty object build cmd:\n$cmd')
verror(err)

View File

@ -139,6 +139,10 @@ fn (mut b Builder) run_compiled_executable_and_exit() {
}
fn (mut v Builder) cleanup_run_executable_after_exit(exefile string) {
if v.pref.reuse_tmpc {
v.pref.vrun_elog('keeping executable: $exefile , because -keepc was passed')
return
}
if os.is_file(exefile) {
v.pref.vrun_elog('remove run executable: $exefile')
os.rm(exefile)