diff --git a/cmd/tools/vself.v b/cmd/tools/vself.v index 83f3160ffb..477c0d5314 100644 --- a/cmd/tools/vself.v +++ b/cmd/tools/vself.v @@ -19,13 +19,18 @@ fn main() { println('V self compiling...') } - s2 := os.exec(cmd) or { panic(err) } - if s2.output.len > 0 { - println(s2.output) - } - if s2.exit_code != 0 { + result := os.exec(cmd) or { panic(err) } + if result.exit_code != 0 { + mut err := 'Permission denied' + if !result.output.contains('Permission denied') { + err = '\n$result.output' + } + eprintln('cannot compile to β€˜$vroot: $err') exit(1) } + if result.output.len > 0 { + println(result.output) + } v_file := if os.user_os() == 'windows' { 'v.exe' } else { 'v' } v2_file := if os.user_os() == 'windows' { 'v2.exe' } else { 'v2' } diff --git a/cmd/tools/vup.v b/cmd/tools/vup.v index 73cc6ba5d2..66631fe1d5 100644 --- a/cmd/tools/vup.v +++ b/cmd/tools/vup.v @@ -6,14 +6,26 @@ import ( ) fn main() { - println('Updating V...') vroot := os.dir(pref.vexe_path()) os.chdir(vroot) + + println('Updating V...') + // git pull - s := os.exec('git pull --rebase origin master') or { + git_result := os.exec('git pull --rebase origin master') or { 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 { v_backup_file := 'v_old.exe' @@ -22,14 +34,14 @@ fn main() { } os.mv('v.exe', v_backup_file) - s2 := os.exec('make.bat') or { + make_result := os.exec('make.bat') or { panic(err) } - println(s2.output) + println(make_result.output) } $else { - s2 := os.exec('make') or { + make_result := os.exec('make') or { panic(err) } - println(s2.output) + println(make_result.output) } } diff --git a/vlib/v/util/util.v b/vlib/v/util/util.v index a9eab58f18..b142757899 100644 --- a/vlib/v/util/util.v +++ b/vlib/v/util/util.v @@ -142,7 +142,12 @@ pub fn launch_tool(is_verbose bool, tool_name string) { } tool_compilation := os.exec(compilation_command) or { panic(err) } 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 {