Skip to content

Commit

Permalink
v.util: make util.launch_tool/3 more robust, by recompiling V tools a…
Browse files Browse the repository at this point in the history
…lways in a known current working folder (vroot) (#18358)
  • Loading branch information
spytheman committed Jun 6, 2023
1 parent 22c0cdc commit 0bbbf1e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vlib/v/util/util.v
Expand Up @@ -180,9 +180,13 @@ pub fn launch_tool(is_verbose bool, tool_name string, args []string) {
println('Compiling ${tool_name} with: "${compilation_command}"')
}

current_work_dir := os.getwd()
retry_max_count := 3
for i in 0 .. retry_max_count {
// ensure a stable and known working folder, when compiling V's tools, to avoid module lookup problems:
os.chdir(vroot) or {}
tool_compilation := os.execute(compilation_command)
os.chdir(current_work_dir) or {}
if tool_compilation.exit_code == 0 {
break
} else {
Expand Down

0 comments on commit 0bbbf1e

Please sign in to comment.