diff --git a/vlib/v/util/util.v b/vlib/v/util/util.v index 89e9acd000..3bb8c7268f 100644 --- a/vlib/v/util/util.v +++ b/vlib/v/util/util.v @@ -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 {