1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

v run: windows and repl fixes

This commit is contained in:
Delyan Angelov 2019-08-09 23:37:31 +03:00 committed by Alexander Medvednikov
parent efa540e883
commit 5c29a7ef7d

View File

@ -197,13 +197,9 @@ fn main() {
} }
if 'run' in args { if 'run' in args {
vsource := v.dir // always recompile for now, too error prone to skip recompilation otherwise
vtarget := final_target_out_name( v.out_name ) // for example for -repl usage, especially when piping lines to v
if os.file_exists(vtarget) && ( os.file_last_mod_unix(vsource) <= os.file_last_mod_unix(vtarget) ) { v.compile()
//println('ALREADY BUILD FROM vsource: $vsource | vtarget: $vtarget')
v.run_compiled_executable_and_exit()
}
v.compile()
v.run_compiled_executable_and_exit() v.run_compiled_executable_and_exit()
} }
@ -646,6 +642,7 @@ fn final_target_out_name(out_name string) string {
$if windows { $if windows {
cmd = out_name cmd = out_name
cmd = cmd.replace('/', '\\') cmd = cmd.replace('/', '\\')
cmd += '.exe'
} }
return cmd return cmd
} }
@ -654,7 +651,7 @@ fn (v V) run_compiled_executable_and_exit() {
if v.pref.is_verbose { if v.pref.is_verbose {
println('============ running $v.out_name ============') println('============ running $v.out_name ============')
} }
mut cmd := final_target_out_name(v.out_name) mut cmd := final_target_out_name(v.out_name).replace('.exe','')
if os.args.len > 3 { if os.args.len > 3 {
cmd += ' ' + os.args.right(3).join(' ') cmd += ' ' + os.args.right(3).join(' ')
} }