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:
parent
7d9d42b2e2
commit
fbf6910ab9
@ -129,20 +129,22 @@ fn (mut b Builder) run_compiled_executable_and_exit() {
|
|||||||
if b.pref.is_verbose {
|
if b.pref.is_verbose {
|
||||||
println('command to run executable: $cmd')
|
println('command to run executable: $cmd')
|
||||||
}
|
}
|
||||||
if b.pref.is_test {
|
if b.pref.is_test || b.pref.is_run {
|
||||||
exit(os.system(cmd))
|
|
||||||
}
|
|
||||||
if b.pref.is_run {
|
|
||||||
ret := os.system(cmd)
|
ret := os.system(cmd)
|
||||||
// TODO: make the runner wrapping as transparent as possible
|
b.cleanup_run_executable_after_exit(exefile)
|
||||||
// (i.e. use execve when implemented). For now though, the runner
|
|
||||||
// just returns the same exit code as the child process.
|
|
||||||
exit(ret)
|
exit(ret)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit(0)
|
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'
|
// 'strings' => 'VROOT/vlib/strings'
|
||||||
// 'installed_mod' => '~/.vmodules/installed_mod'
|
// 'installed_mod' => '~/.vmodules/installed_mod'
|
||||||
// 'local_mod' => '/path/to/current/dir/local_mod'
|
// 'local_mod' => '/path/to/current/dir/local_mod'
|
||||||
|
@ -486,7 +486,7 @@ pub fn parse_args(args []string) (&Preferences, string) {
|
|||||||
return res, command
|
return res, command
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (pref &Preferences) vrun_elog(s string) {
|
pub fn (pref &Preferences) vrun_elog(s string) {
|
||||||
if pref.is_verbose {
|
if pref.is_verbose {
|
||||||
eprintln('> v run -, $s')
|
eprintln('> v run -, $s')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user