From 51649b924b8f1414e6ae2f52d32f4c4f7c1c9b39 Mon Sep 17 00:00:00 2001 From: Joe Conigliaro Date: Wed, 29 Jun 2022 18:54:26 +1000 Subject: [PATCH] gen.golang: dont push run_args in run_file assignent --- vlib/v/builder/compile.v | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vlib/v/builder/compile.v b/vlib/v/builder/compile.v index 5e4f4601f9..c21c2be4e2 100644 --- a/vlib/v/builder/compile.v +++ b/vlib/v/builder/compile.v @@ -83,15 +83,12 @@ fn (mut b Builder) run_compiled_executable_and_exit() { exit(0) } compiled_file := os.real_path(b.pref.out_name) - mut run_args := []string{cap: b.pref.run_args.len + 1} run_file := if b.pref.backend.is_js() { - run_args << compiled_file node_basename := $if windows { 'node.exe' } $else { 'node' } os.find_abs_path_of_executable(node_basename) or { panic('Could not find `$node_basename` in system path. Do you have Node.js installed?') } } else if b.pref.backend == .golang { - run_args << ['run', compiled_file] go_basename := $if windows { 'go.exe' } $else { 'go' } os.find_abs_path_of_executable(go_basename) or { panic('Could not find `$go_basename` in system path. Do you have Node.js installed?') @@ -99,6 +96,12 @@ fn (mut b Builder) run_compiled_executable_and_exit() { } else { compiled_file } + mut run_args := []string{cap: b.pref.run_args.len + 1} + if b.pref.backend.is_js() { + run_args << compiled_file + } else if b.pref.backend == .golang { + run_args << ['run', compiled_file] + } run_args << b.pref.run_args mut run_process := os.new_process(run_file) run_process.set_args(run_args)