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:
parent
22c0cdc192
commit
0bbbf1e801
@ -180,9 +180,13 @@ pub fn launch_tool(is_verbose bool, tool_name string, args []string) {
|
|||||||
println('Compiling ${tool_name} with: "${compilation_command}"')
|
println('Compiling ${tool_name} with: "${compilation_command}"')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
current_work_dir := os.getwd()
|
||||||
retry_max_count := 3
|
retry_max_count := 3
|
||||||
for i in 0 .. retry_max_count {
|
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)
|
tool_compilation := os.execute(compilation_command)
|
||||||
|
os.chdir(current_work_dir) or {}
|
||||||
if tool_compilation.exit_code == 0 {
|
if tool_compilation.exit_code == 0 {
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user