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

builder: remove executables after v run file.v

This commit is contained in:
Delyan Angelov 2020-12-05 13:03:12 +02:00
parent 7d9d42b2e2
commit fbf6910ab9
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 10 additions and 8 deletions

View File

@ -129,20 +129,22 @@ fn (mut b Builder) run_compiled_executable_and_exit() {
if b.pref.is_verbose {
println('command to run executable: $cmd')
}
if b.pref.is_test {
exit(os.system(cmd))
}
if b.pref.is_run {
if b.pref.is_test || b.pref.is_run {
ret := os.system(cmd)
// TODO: make the runner wrapping as transparent as possible
// (i.e. use execve when implemented). For now though, the runner
// just returns the same exit code as the child process.
b.cleanup_run_executable_after_exit(exefile)
exit(ret)
}
}
exit(0)
}
fn (mut v Builder) cleanup_run_executable_after_exit(exefile string) {
if os.is_file(exefile) {
v.pref.vrun_elog('remove run executable: $exefile')
os.rm(exefile)
}
}
// 'strings' => 'VROOT/vlib/strings'
// 'installed_mod' => '~/.vmodules/installed_mod'
// 'local_mod' => '/path/to/current/dir/local_mod'

View File

@ -486,7 +486,7 @@ pub fn parse_args(args []string) (&Preferences, string) {
return res, command
}
fn (pref &Preferences) vrun_elog(s string) {
pub fn (pref &Preferences) vrun_elog(s string) {
if pref.is_verbose {
eprintln('> v run -, $s')
}