cmd: show cleaner messages, when v can not compile a tool, or update itself
parent
0024ff848d
commit
7cf9b32742
|
@ -19,13 +19,18 @@ fn main() {
|
||||||
println('V self compiling...')
|
println('V self compiling...')
|
||||||
}
|
}
|
||||||
|
|
||||||
s2 := os.exec(cmd) or { panic(err) }
|
result := os.exec(cmd) or { panic(err) }
|
||||||
if s2.output.len > 0 {
|
if result.exit_code != 0 {
|
||||||
println(s2.output)
|
mut err := 'Permission denied'
|
||||||
}
|
if !result.output.contains('Permission denied') {
|
||||||
if s2.exit_code != 0 {
|
err = '\n$result.output'
|
||||||
|
}
|
||||||
|
eprintln('cannot compile to ‘$vroot: $err')
|
||||||
exit(1)
|
exit(1)
|
||||||
}
|
}
|
||||||
|
if result.output.len > 0 {
|
||||||
|
println(result.output)
|
||||||
|
}
|
||||||
|
|
||||||
v_file := if os.user_os() == 'windows' { 'v.exe' } else { 'v' }
|
v_file := if os.user_os() == 'windows' { 'v.exe' } else { 'v' }
|
||||||
v2_file := if os.user_os() == 'windows' { 'v2.exe' } else { 'v2' }
|
v2_file := if os.user_os() == 'windows' { 'v2.exe' } else { 'v2' }
|
||||||
|
|
|
@ -6,14 +6,26 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println('Updating V...')
|
|
||||||
vroot := os.dir(pref.vexe_path())
|
vroot := os.dir(pref.vexe_path())
|
||||||
os.chdir(vroot)
|
os.chdir(vroot)
|
||||||
|
|
||||||
|
println('Updating V...')
|
||||||
|
|
||||||
// git pull
|
// git pull
|
||||||
s := os.exec('git pull --rebase origin master') or {
|
git_result := os.exec('git pull --rebase origin master') or {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
println(s.output)
|
|
||||||
|
if git_result.exit_code != 0 {
|
||||||
|
if git_result.output.contains('Permission denied') {
|
||||||
|
eprintln('have no access ‘$vroot: Permission denied')
|
||||||
|
} else {
|
||||||
|
eprintln(git_result.output)
|
||||||
|
}
|
||||||
|
exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
println(git_result.output)
|
||||||
|
|
||||||
$if windows {
|
$if windows {
|
||||||
v_backup_file := 'v_old.exe'
|
v_backup_file := 'v_old.exe'
|
||||||
|
@ -22,14 +34,14 @@ fn main() {
|
||||||
}
|
}
|
||||||
os.mv('v.exe', v_backup_file)
|
os.mv('v.exe', v_backup_file)
|
||||||
|
|
||||||
s2 := os.exec('make.bat') or {
|
make_result := os.exec('make.bat') or {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
println(s2.output)
|
println(make_result.output)
|
||||||
} $else {
|
} $else {
|
||||||
s2 := os.exec('make') or {
|
make_result := os.exec('make') or {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
println(s2.output)
|
println(make_result.output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,12 @@ pub fn launch_tool(is_verbose bool, tool_name string) {
|
||||||
}
|
}
|
||||||
tool_compilation := os.exec(compilation_command) or { panic(err) }
|
tool_compilation := os.exec(compilation_command) or { panic(err) }
|
||||||
if tool_compilation.exit_code != 0 {
|
if tool_compilation.exit_code != 0 {
|
||||||
panic('V tool "$tool_source" could not be compiled\n' + tool_compilation.output)
|
mut err := 'Permission denied'
|
||||||
|
if !tool_compilation.output.contains('Permission denied') {
|
||||||
|
err = '\n$tool_compilation.output'
|
||||||
|
}
|
||||||
|
eprintln('cannot compile ‘$tool_source: $err‘')
|
||||||
|
exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if is_verbose {
|
if is_verbose {
|
||||||
|
|
Loading…
Reference in New Issue