tools: fix panicing on a failing make in `v up`, or recompilation of vup.v

pull/9204/head
Delyan Angelov 2021-03-08 23:51:46 +02:00
parent b893373e63
commit a9358e4948
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 16 additions and 2 deletions

View File

@ -41,7 +41,7 @@ fn main() {
app.backup('cmd/tools/vup.exe') app.backup('cmd/tools/vup.exe')
} }
app.recompile_v() app.recompile_v()
os.execute_or_panic('"$app.vexe" cmd/tools/vup.v') app.recompile_vup()
app.show_current_v_version() app.show_current_v_version()
} }
@ -82,12 +82,26 @@ fn (app App) recompile_v() {
app.make(vself) app.make(vself)
} }
fn (app App) recompile_vup() {
vup_result := os.execute('"$app.vexe" -g cmd/tools/vup.v')
if vup_result.exit_code != 0 {
eprintln('recompiling vup.v failed:')
eprintln(vup_result.output)
}
}
fn (app App) make(vself string) { fn (app App) make(vself string) {
mut make := 'make' mut make := 'make'
$if windows { $if windows {
make = 'make.bat' make = 'make.bat'
} }
make_result := os.execute_or_panic(make) make_result := os.execute(make)
if make_result.exit_code != 0 {
eprintln('> $make failed:')
eprintln('> make output:')
eprintln(make_result.output)
return
}
app.vprintln(make_result.output) app.vprintln(make_result.output)
} }