diff --git a/cmd/tools/vtest-all.v b/cmd/tools/vtest-all.v index 77c46ffaf7..39bef726f0 100644 --- a/cmd/tools/vtest-all.v +++ b/cmd/tools/vtest-all.v @@ -210,8 +210,9 @@ fn get_all_commands() []Command { rmfile: 'examples/tetris/tetris' } $if macos || linux { + ipath := '$vroot/thirdparty/stdatomic/nix' res << Command{ - line: '$vexe -o v.c cmd/v && cc -Werror -I "$vroot/thirdparty/stdatomic/nix" v.c -lpthread -lm && rm -rf a.out' + line: '$vexe -o v.c cmd/v && cc -Werror -I ${os.quoted_path(ipath)} v.c -lpthread -lm && rm -rf a.out' label: 'v.c should be buildable with no warnings...' okmsg: 'v.c can be compiled without warnings. This is good :)' rmfile: 'v.c' diff --git a/vlib/gg/draw_fns_api_test.v b/vlib/gg/draw_fns_api_test.v index e8c576e1a0..bde10a1deb 100644 --- a/vlib/gg/draw_fns_api_test.v +++ b/vlib/gg/draw_fns_api_test.v @@ -6,7 +6,7 @@ fn test_all_samples_can_be_compiled() { samples := os.walk_ext('$vroot/vlib/gg/testdata', '.vv') mut fails := []string{} for program_source in samples { - compile_cmd := '"$vexe" "$program_source"' + compile_cmd := '${os.quoted_path(vexe)} ${os.quoted_path(program_source)}' res := os.execute(compile_cmd) if res.exit_code != 0 { eprintln('>>> FAIL $compile_cmd') diff --git a/vlib/v/compiler_errors_test.v b/vlib/v/compiler_errors_test.v index 120babf888..999e1cc30f 100644 --- a/vlib/v/compiler_errors_test.v +++ b/vlib/v/compiler_errors_test.v @@ -295,7 +295,7 @@ fn (mut task TaskDescription) execute() { return } program := task.path - cli_cmd := '$task.vexe $task.voptions $program' + cli_cmd := '${os.quoted_path(task.vexe)} $task.voptions ${os.quoted_path(program)}' res := os.execute(cli_cmd) expected_out_path := program.replace('.vv', '') + task.result_extension task.expected_out_path = expected_out_path diff --git a/vlib/v/eval/interpret_test.v b/vlib/v/eval/interpret_test.v index 7a2a635405..6dbea784ff 100644 --- a/vlib/v/eval/interpret_test.v +++ b/vlib/v/eval/interpret_test.v @@ -24,7 +24,7 @@ fn test_interpret() ? { full_test_path := os.real_path(os.join_path(dir, test)) test_file_name := os.file_name(test) relative_test_path := full_test_path.replace(vroot + '/', '') - cmd := '"$vexe" interpret "$full_test_path"' + cmd := '${os.quoted_path(vexe)} interpret ${os.quoted_path(full_test_path)}' if is_verbose { println(cmd) } diff --git a/vlib/v/gen/native/tests/native_test.v b/vlib/v/gen/native/tests/native_test.v index 9ff8998368..4b840b3152 100644 --- a/vlib/v/gen/native/tests/native_test.v +++ b/vlib/v/gen/native/tests/native_test.v @@ -36,7 +36,7 @@ fn test_native() { relative_test_path := full_test_path.replace(vroot + '/', '') work_test_path := '$wrkdir/$test_file_name' exe_test_path := '$wrkdir/${test_file_name}.exe' - cmd := '"$vexe" -o "$exe_test_path" -b native "$full_test_path"' + cmd := '${os.quoted_path(vexe)} -o ${os.quoted_path(exe_test_path)} -b native ${os.quoted_path(full_test_path)}' if is_verbose { println(cmd) } @@ -47,7 +47,7 @@ fn test_native() { continue } tmperrfile := '$dir/${test}.tmperr' - res := os.execute('$exe_test_path 2> $tmperrfile') + res := os.execute('${os.quoted_path(exe_test_path)} 2> ${os.quoted_path(tmperrfile)}') if res.exit_code != 0 { bench.fail() eprintln(bench.step_message_fail('$full_test_path failed to run')) diff --git a/vlib/v/live/executable/reloader.v b/vlib/v/live/executable/reloader.v index 960f543993..1b7c8d0f7a 100644 --- a/vlib/v/live/executable/reloader.v +++ b/vlib/v/live/executable/reloader.v @@ -66,7 +66,7 @@ fn compile_and_reload_shared_lib(mut r live.LiveReloadInfo) ?bool { fn compile_lib(mut r live.LiveReloadInfo) ?string { new_lib_path, new_lib_path_with_extension := current_shared_library_path(mut r) - cmd := '$r.vexe $r.vopts -o $new_lib_path $r.original' + cmd := '${os.quoted_path(r.vexe)} $r.vopts -o ${os.quoted_path(new_lib_path)} ${os.quoted_path(r.original)}' elog(r, '> compilation cmd: $cmd') cwatch := time.new_stopwatch() recompilation_result := os.execute(cmd) diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index de35a05734..d0d57cbd68 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -688,7 +688,7 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin mut output_option := '' if tmp_exe_file_path == '' { tmp_exe_file_path = '${tmp_file_path}.exe' - output_option = '-o "$tmp_exe_file_path"' + output_option = '-o ${os.quoted_path(tmp_exe_file_path)} ' } tmp_v_file_path := '${tmp_file_path}.v' contents := os.get_raw_lines_joined() @@ -698,7 +698,7 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin run_options := cmdline.options_before(args, ['run']).join(' ') command_options := cmdline.options_after(args, ['run'])[1..].join(' ') vexe := vexe_path() - tmp_cmd := '"$vexe" $output_option $run_options run "$tmp_v_file_path" $command_options' + tmp_cmd := '${os.quoted_path(vexe)} $output_option $run_options run ${os.quoted_path(tmp_v_file_path)} $command_options' // res.vrun_elog('tmp_cmd: $tmp_cmd') tmp_result := os.system(tmp_cmd) diff --git a/vlib/v/tests/projects_that_should_compile_test.v b/vlib/v/tests/projects_that_should_compile_test.v index ecfe801c40..fe6a2eb43e 100644 --- a/vlib/v/tests/projects_that_should_compile_test.v +++ b/vlib/v/tests/projects_that_should_compile_test.v @@ -9,7 +9,7 @@ fn vroot_path(relpath string) string { } fn vrun_ok(options string, path string) string { - cmd := '${@VEXE} $options $path' + cmd := '${os.quoted_path(@VEXE)} $options ${os.quoted_path(path)}' res := os.execute(cmd) if res.exit_code != 0 { eprintln('> failing vrun cmd: $cmd') diff --git a/vlib/v/tests/repl/repl_test.v b/vlib/v/tests/repl/repl_test.v index 5b63532c8e..830de4cabe 100644 --- a/vlib/v/tests/repl/repl_test.v +++ b/vlib/v/tests/repl/repl_test.v @@ -11,11 +11,11 @@ fn test_the_v_compiler_can_be_invoked() { vexec := runner.full_path_to_v(5) println('vexecutable: $vexec') assert vexec != '' - vcmd := '"$vexec" -version' + vcmd := '${os.quoted_path(vexec)} -version' r := os.execute_or_exit(vcmd) assert r.exit_code == 0 // println('"$vcmd" exit_code: $r.exit_code | output: $r.output') - vcmd_error := '"$vexec" nonexisting.v' + vcmd_error := '${os.quoted_path(vexec)} nonexisting.v' r_error := os.execute(vcmd_error) if r_error.exit_code < 0 { panic(r_error.output) diff --git a/vlib/v/tests/repl/runner/runner.v b/vlib/v/tests/repl/runner/runner.v index f5f53667a9..9a4833cf77 100644 --- a/vlib/v/tests/repl/runner/runner.v +++ b/vlib/v/tests/repl/runner/runner.v @@ -49,7 +49,7 @@ pub fn run_repl_file(wd string, vexec string, file string) ?string { input_temporary_filename := os.real_path(os.join_path(wd, 'input_temporary_filename.txt')) os.write_file(input_temporary_filename, input) or { panic(err) } os.write_file(os.real_path(os.join_path(wd, 'original.txt')), fcontent) or { panic(err) } - rcmd := '"$vexec" repl -replfolder "$wd" -replprefix "${fname}." < $input_temporary_filename' + rcmd := '${os.quoted_path(vexec)} repl -replfolder ${os.quoted_path(wd)} -replprefix "${fname}." < ${os.quoted_path(input_temporary_filename)}' r := os.execute(rcmd) if r.exit_code < 0 { os.rm(input_temporary_filename) ? @@ -84,7 +84,7 @@ pub fn run_prod_file(wd string, vexec string, file string) ?string { return error('Could not read expected prod file $file_expected') } expected_content := f_expected_content.replace('\r', '') - cmd := '"$vexec" -prod run "$file"' + cmd := '${os.quoted_path(vexec)} -prod run ${os.quoted_path(file)}' r := os.execute(cmd) if r.exit_code < 0 { return error('Could not execute: $cmd') diff --git a/vlib/v/tests/run_v_code_from_stdin_test.v b/vlib/v/tests/run_v_code_from_stdin_test.v index 31de20250e..174bafb0b2 100644 --- a/vlib/v/tests/run_v_code_from_stdin_test.v +++ b/vlib/v/tests/run_v_code_from_stdin_test.v @@ -14,7 +14,7 @@ fn pipe_to_v_run() ? { // eprintln('>>> tmp_v_file: $tmp_v_file') os.write_file(tmp_v_file, 'println(1 + 3)\nprintln("hello")\n') ? assert os.is_file(tmp_v_file) - cmd := '$cat_cmd "$tmp_v_file" | "$vexe" run -' + cmd := '$cat_cmd ${os.quoted_path(tmp_v_file)} | ${os.quoted_path(vexe)} run -' res := os.execute(cmd) // eprintln('>> cmd: $cmd | res: $res') assert res.exit_code == 0 diff --git a/vlib/v/tests/valgrind/valgrind_test.v b/vlib/v/tests/valgrind/valgrind_test.v index 036362d9c5..51b6ab7b46 100644 --- a/vlib/v/tests/valgrind/valgrind_test.v +++ b/vlib/v/tests/valgrind/valgrind_test.v @@ -85,7 +85,7 @@ fn test_all() { base_filename := os.file_name(test).replace('.v', '') exe_filename := '$wrkdir/$base_filename' full_path_to_source_file := os.join_path(vroot, test) - compile_cmd := '"$vexe" -o "$exe_filename" -cg -cflags "-w" -experimental -autofree "$full_path_to_source_file"' + compile_cmd := '${os.quoted_path(vexe)} -o ${os.quoted_path(exe_filename)} -cg -cflags "-w" -experimental -autofree ${os.quoted_path(full_path_to_source_file)}' vprintln('compile cmd: ${bold(compile_cmd)}') res := os.execute(compile_cmd) if res.exit_code != 0 { @@ -102,7 +102,7 @@ fn test_all() { continue } } - valgrind_cmd := 'valgrind --error-exitcode=1 --leak-check=full "$exe_filename"' + valgrind_cmd := 'valgrind --error-exitcode=1 --leak-check=full ${os.quoted_path(exe_filename)}' vprintln('valgrind cmd: ${bold(valgrind_cmd)}') valgrind_res := os.execute(valgrind_cmd) if valgrind_res.exit_code != 0 { diff --git a/vlib/v/util/util.v b/vlib/v/util/util.v index 68972033f0..b6a74c8c68 100644 --- a/vlib/v/util/util.v +++ b/vlib/v/util/util.v @@ -178,7 +178,7 @@ pub fn launch_tool(is_verbose bool, tool_name string, args []string) { exit(os.system('${os.quoted_path(tool_exe)} $tool_args')) } $else $if js { // no way to implement os.execvp in JS backend - exit(os.system('${os.quote_path(tool_exe)} $tool_args')) + exit(os.system('$tool_exe $tool_args')) } $else { os.execvp(tool_exe, args) or { panic(err) } }