diff --git a/vlib/v/help/help.v b/vlib/v/help/help.v index 214cac85e1..218ebb2639 100644 --- a/vlib/v/help/help.v +++ b/vlib/v/help/help.v @@ -10,10 +10,7 @@ fn hdir(base string) string { } fn help_dir() string { - mut vexe := os.getenv('VEXE') - if vexe == '' { - vexe = os.executable() - } + vexe := get_vexe() if vexe != '' { return hdir(os.dir(vexe)) } @@ -42,7 +39,8 @@ pub fn print_and_exit(topic string, opts ExitOptions) { } } if topic in help.cli_topics { - os.system('${@VEXE} ${topic} --help') + vexe := get_vexe() + os.system('${os.quoted_path(vexe)} ${topic} --help') exit(opts.exit_code) } mut topic_path := '' @@ -79,3 +77,11 @@ fn print_known_topics() { } println(res) } + +fn get_vexe() string { + mut vexe := os.getenv('VEXE') + if vexe == '' { + vexe = os.executable() + } + return vexe +}