Skip to content

Commit

Permalink
ci, builder: retry building of thirdparty object files with msvc, in …
Browse files Browse the repository at this point in the history
…case of linker errors too
  • Loading branch information
spytheman committed Dec 2, 2023
1 parent c6ea403 commit 855b5c2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions vlib/v/builder/msvc_windows.v
Original file line number Diff line number Diff line change
Expand Up @@ -443,13 +443,16 @@ fn (mut v Builder) build_thirdparty_obj_file_with_msvc(mod string, path string,
flush_stdout()
}
// Note, that building object files with msvc can fail with permission denied errors,
// when the final .obj file, is locked by another msvc process for writing.
// when the final .obj file, is locked by another msvc process for writing, or linker errors.
// Instead of failing, just retry several times in this case.
mut res := os.Result{}
mut i := 0
for i = 0; i < builder.thirdparty_obj_build_max_retries; i++ {
res = os.execute(cmd)
if res.exit_code == 0 || !res.output.contains('Permission denied') {
if res.exit_code == 0 {
break
}
if !(res.output.contains('Permission denied') || res.output.contains('cannot open file')) {
break
}
eprintln('---------------------------------------------------------------------')
Expand Down

0 comments on commit 855b5c2

Please sign in to comment.