1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

v.util: make util.launch_tool/3 more robust, by recompiling V tools always in a known current working folder (vroot) (#18358)

This commit is contained in:
Delyan Angelov 2023-06-06 18:01:58 +03:00 committed by GitHub
parent 22c0cdc192
commit 0bbbf1e801
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {