mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: bring back panic(err.msg)
-> panic(err)
(#9022)
This commit is contained in:
@ -50,7 +50,7 @@ fn main() {
|
||||
date := time.unix(commit_date.int())
|
||||
mut out := os.create('table.html') ?
|
||||
// Place the new row on top
|
||||
table =
|
||||
table =
|
||||
'<tr>
|
||||
<td>$date.format()</td>
|
||||
<td><a target=_blank href="https://github.com/vlang/v/commit/$commit">$commit</a></td>
|
||||
@ -81,7 +81,7 @@ fn main() {
|
||||
}
|
||||
|
||||
fn exec(s string) string {
|
||||
e := os.exec(s) or { panic(err.msg) }
|
||||
e := os.exec(s) or { panic(err) }
|
||||
return e.output.trim_right('\r\n')
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ fn measure(cmd string, description string) int {
|
||||
}
|
||||
|
||||
fn measure_steps(vdir string) (int, int, int) {
|
||||
resp := os.exec('$vdir/vprod -o v.c -show-timings $vdir/cmd/v') or { panic(err.msg) }
|
||||
resp := os.exec('$vdir/vprod -o v.c -show-timings $vdir/cmd/v') or { panic(err) }
|
||||
lines := resp.output.split_into_lines()
|
||||
if lines.len != 3 {
|
||||
return 0, 0, 0
|
||||
|
@ -210,7 +210,7 @@ fn (mut gen_vc GenVC) generate() {
|
||||
// check if gen_vc dir exists
|
||||
if !os.is_dir(gen_vc.options.work_dir) {
|
||||
// try create
|
||||
os.mkdir(gen_vc.options.work_dir) or { panic(err.msg) }
|
||||
os.mkdir(gen_vc.options.work_dir) or { panic(err) }
|
||||
// still dosen't exist... we have a problem
|
||||
if !os.is_dir(gen_vc.options.work_dir) {
|
||||
gen_vc.logger.error('error creating directory: $gen_vc.options.work_dir')
|
||||
@ -246,8 +246,8 @@ fn (mut gen_vc GenVC) generate() {
|
||||
ts_v := git_log_v.find_between('Date:', '\n').trim_space()
|
||||
ts_vc := git_log_vc.find_between('Date:', '\n').trim_space()
|
||||
// parse time as string to time.Time
|
||||
last_commit_time_v := time.parse(ts_v) or { panic(err.msg) }
|
||||
last_commit_time_vc := time.parse(ts_vc) or { panic(err.msg) }
|
||||
last_commit_time_v := time.parse(ts_v) or { panic(err) }
|
||||
last_commit_time_vc := time.parse(ts_vc) or { panic(err) }
|
||||
// git dates are in users local timezone and v time.parse does not parse
|
||||
// timezones at the moment, so for now get unix timestamp from output also
|
||||
t_unix_v := git_log_v.find_between('Date Unix:', '\n').trim_space().int()
|
||||
|
@ -55,7 +55,7 @@ fn report_undocumented_functions_in_path(opt Options, path string) {
|
||||
}
|
||||
|
||||
fn report_undocumented_functions_in_file(opt Options, file string) {
|
||||
contents := os.read_file(file) or { panic(err.msg) }
|
||||
contents := os.read_file(file) or { panic(err) }
|
||||
lines := contents.split('\n')
|
||||
mut info := []UndocumentedFN{}
|
||||
for i, line in lines {
|
||||
|
@ -53,9 +53,9 @@ pub fn rmrf(path string) {
|
||||
verbose_trace(@FN, 'rm -rf $path')
|
||||
if os.exists(path) {
|
||||
if os.is_dir(path) {
|
||||
os.rmdir_all(path) or { panic(err.msg) }
|
||||
os.rmdir_all(path) or { panic(err) }
|
||||
} else {
|
||||
os.rm(path) or { panic(err.msg) }
|
||||
os.rm(path) or { panic(err) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ pub fn (mut ts TestSession) test() {
|
||||
// cleanup generated .tmp.c files after successfull tests:
|
||||
if ts.benchmark.nfail == 0 {
|
||||
if ts.rm_binaries {
|
||||
os.rmdir_all(ts.vtmp_dir) or { panic(err.msg) }
|
||||
os.rmdir_all(ts.vtmp_dir) or { panic(err) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -255,7 +255,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
|
||||
generated_binary_fpath := os.join_path(tmpd, generated_binary_fname)
|
||||
if os.exists(generated_binary_fpath) {
|
||||
if ts.rm_binaries {
|
||||
os.rm(generated_binary_fpath) or { panic(err.msg) }
|
||||
os.rm(generated_binary_fpath) or { panic(err) }
|
||||
}
|
||||
}
|
||||
mut cmd_options := [ts.vargs]
|
||||
@ -308,7 +308,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
|
||||
}
|
||||
if os.exists(generated_binary_fpath) {
|
||||
if ts.rm_binaries {
|
||||
os.rm(generated_binary_fpath) or { panic(err.msg) }
|
||||
os.rm(generated_binary_fpath) or { panic(err) }
|
||||
}
|
||||
}
|
||||
return pool.no_result
|
||||
@ -358,7 +358,7 @@ pub fn prepare_test_session(zargs string, folder string, oskipped []string, main
|
||||
continue
|
||||
}
|
||||
}
|
||||
c := os.read_file(f) or { panic(err.msg) }
|
||||
c := os.read_file(f) or { panic(err) }
|
||||
maxc := if c.len > 300 { 300 } else { c.len }
|
||||
start := c[0..maxc]
|
||||
if start.contains('module ') && !start.contains('module main') {
|
||||
@ -436,7 +436,7 @@ pub fn header(msg string) {
|
||||
pub fn setup_new_vtmp_folder() string {
|
||||
now := time.sys_mono_now()
|
||||
new_vtmp_dir := os.join_path(os.temp_dir(), 'v', 'test_session_$now')
|
||||
os.mkdir_all(new_vtmp_dir) or { panic(err.msg) }
|
||||
os.mkdir_all(new_vtmp_dir) or { panic(err) }
|
||||
os.setenv('VTMP', new_vtmp_dir, true)
|
||||
return new_vtmp_dir
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ fn main() {
|
||||
scripting.cprintln('# checkout folder: $context.path_v')
|
||||
if context.cmd_to_run.len > 0 {
|
||||
cmdres := os.exec(context.cmd_to_run) or {
|
||||
panic(err.msg)
|
||||
panic(err)
|
||||
}
|
||||
scripting.cprintln('# command: ${context.cmd_to_run:-34s} exit code: ${cmdres.exit_code:-4d} result:')
|
||||
println(cmdres.output)
|
||||
|
@ -28,16 +28,16 @@ fn get_vexe_path() string {
|
||||
fn new_tdir() string {
|
||||
tdir_ := os.join_path(os.temp_dir(), rand.ulid())
|
||||
if os.exists(tdir_) {
|
||||
os.rmdir(tdir_) or { panic(err.msg) }
|
||||
os.rmdir(tdir_) or { panic(err) }
|
||||
}
|
||||
os.mkdir(tdir_) or { panic(err.msg) }
|
||||
os.mkdir(tdir_) or { panic(err) }
|
||||
C.atexit(cleanup_tdir)
|
||||
return tdir_
|
||||
}
|
||||
|
||||
fn cleanup_tdir() {
|
||||
println('... removing tdir: $tdir')
|
||||
os.rmdir_all(tdir) or { panic(err.msg) }
|
||||
os.rmdir_all(tdir) or { panic(err) }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
@ -55,7 +55,7 @@ fn main() {
|
||||
|
||||
fn check_ok(cmd string) string {
|
||||
println('> check_ok cmd: $cmd')
|
||||
res := os.exec(cmd) or { panic(err.msg) }
|
||||
res := os.exec(cmd) or { panic(err) }
|
||||
if res.exit_code != 0 {
|
||||
eprintln('> check_ok failed.\n$res.output')
|
||||
exit(1)
|
||||
@ -65,7 +65,7 @@ fn check_ok(cmd string) string {
|
||||
|
||||
fn check_fail(cmd string) string {
|
||||
println('> check_fail cmd: $cmd')
|
||||
res := os.exec(cmd) or { panic(err.msg) }
|
||||
res := os.exec(cmd) or { panic(err) }
|
||||
if res.exit_code == 0 {
|
||||
eprintln('> check_fail succeeded, but it should have failed.\n$res.output')
|
||||
exit(1)
|
||||
|
@ -55,7 +55,7 @@ fn main() {
|
||||
//
|
||||
tpath := os.join_path(session.vtmp_dir, texe)
|
||||
if tname in tools_in_subfolders {
|
||||
os.mv_by_cp(tpath, os.join_path(tfolder, tname, texe)) or { panic(err.msg) }
|
||||
os.mv_by_cp(tpath, os.join_path(tfolder, tname, texe)) or { panic(err) }
|
||||
continue
|
||||
}
|
||||
os.mv_by_cp(tpath, os.join_path(tfolder, texe)) or {
|
||||
|
@ -244,7 +244,7 @@ fn (mut f MDFile) check_examples() (int, int) {
|
||||
mut should_cleanup_vfile := true
|
||||
// eprintln('>>> checking example $vfile ...')
|
||||
vcontent := e.text.join('\n') + '\n'
|
||||
os.write_file(vfile, vcontent) or { panic(err.msg) }
|
||||
os.write_file(vfile, vcontent) or { panic(err) }
|
||||
mut acommands := e.command.split(' ')
|
||||
nofmt := 'nofmt' in acommands
|
||||
for command in acommands {
|
||||
@ -331,7 +331,7 @@ fn (mut f MDFile) check_examples() (int, int) {
|
||||
}
|
||||
}
|
||||
if should_cleanup_vfile {
|
||||
os.rm(vfile) or { panic(err.msg) }
|
||||
os.rm(vfile) or { panic(err) }
|
||||
}
|
||||
}
|
||||
return errors, oks
|
||||
|
@ -58,7 +58,7 @@ fn (c &Create) write_vmod(new bool) {
|
||||
cerror(err.msg)
|
||||
exit(1)
|
||||
}
|
||||
vmod.write_str(vmod_content(c.name, c.description)) or { panic(err.msg) }
|
||||
vmod.write_str(vmod_content(c.name, c.description)) or { panic(err) }
|
||||
vmod.close()
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ fn (c &Create) write_main(new bool) {
|
||||
cerror(err.msg)
|
||||
exit(2)
|
||||
}
|
||||
mainfile.write_str(main_content()) or { panic(err.msg) }
|
||||
mainfile.write_str(main_content()) or { panic(err) }
|
||||
mainfile.close()
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ fn (c &Create) create_git_repo(dir string) {
|
||||
// We don't really need a .gitignore, it's just a nice-to-have
|
||||
return
|
||||
}
|
||||
fl.write_str(gen_gitignore(c.name)) or { panic(err.msg) }
|
||||
fl.write_str(gen_gitignore(c.name)) or { panic(err) }
|
||||
fl.close()
|
||||
}
|
||||
}
|
||||
@ -110,7 +110,7 @@ fn create() {
|
||||
}
|
||||
c.description = os.input('Input your project description: ')
|
||||
println('Initialising ...')
|
||||
os.mkdir(c.name) or { panic(err.msg) }
|
||||
os.mkdir(c.name) or { panic(err) }
|
||||
c.write_vmod(true)
|
||||
c.write_main(true)
|
||||
c.create_git_repo(c.name)
|
||||
|
@ -126,7 +126,7 @@ fn (vd VDoc) render_search_index(out Output) {
|
||||
js_search_index.writeln('];')
|
||||
js_search_data.writeln('];')
|
||||
out_file_path := os.join_path(out.path, 'search_index.js')
|
||||
os.write_file(out_file_path, js_search_index.str() + js_search_data.str()) or { panic(err.msg) }
|
||||
os.write_file(out_file_path, js_search_index.str() + js_search_data.str()) or { panic(err) }
|
||||
}
|
||||
|
||||
fn (mut vd VDoc) render_static_html(out Output) {
|
||||
@ -162,7 +162,7 @@ fn (vd VDoc) get_resource(name string, out Output) string {
|
||||
output_path := os.join_path(out.path, name)
|
||||
if !os.exists(output_path) {
|
||||
println('Generating $out.typ in "$output_path"')
|
||||
os.write_file(output_path, res) or { panic(err.msg) }
|
||||
os.write_file(output_path, res) or { panic(err) }
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ fn (vd VDoc) work_processor(mut work sync.Channel, mut wg sync.WaitGroup) {
|
||||
file_name, content := vd.render_doc(pdoc.d, pdoc.out)
|
||||
output_path := os.join_path(pdoc.out.path, file_name)
|
||||
println('Generating $pdoc.out.typ in "$output_path"')
|
||||
os.write_file(output_path, content) or { panic(err.msg) }
|
||||
os.write_file(output_path, content) or { panic(err) }
|
||||
}
|
||||
wg.done()
|
||||
}
|
||||
@ -350,15 +350,15 @@ fn (mut vd VDoc) generate_docs_from_file() {
|
||||
out.path = os.real_path('.')
|
||||
}
|
||||
if !os.exists(out.path) {
|
||||
os.mkdir(out.path) or { panic(err.msg) }
|
||||
os.mkdir(out.path) or { panic(err) }
|
||||
}
|
||||
if cfg.is_multi {
|
||||
out.path = os.join_path(out.path, '_docs')
|
||||
if !os.exists(out.path) {
|
||||
os.mkdir(out.path) or { panic(err.msg) }
|
||||
os.mkdir(out.path) or { panic(err) }
|
||||
} else {
|
||||
for fname in css_js_assets {
|
||||
os.rm(os.join_path(out.path, fname)) or { panic(err.msg) }
|
||||
os.rm(os.join_path(out.path, fname)) or { panic(err) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -372,11 +372,11 @@ fn (mut vd VDoc) generate_docs_from_file() {
|
||||
vd.render_search_index(out)
|
||||
// move favicons to target directory
|
||||
println('Copying favicons...')
|
||||
favicons := os.ls(favicons_path) or { panic(err.msg) }
|
||||
favicons := os.ls(favicons_path) or { panic(err) }
|
||||
for favicon in favicons {
|
||||
favicon_path := os.join_path(favicons_path, favicon)
|
||||
destination_path := os.join_path(out.path, favicon)
|
||||
os.cp(favicon_path, destination_path) or { panic(err.msg) }
|
||||
os.cp(favicon_path, destination_path) or { panic(err) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ fn (foptions &FormatOptions) format_file(file string) {
|
||||
file_name := os.file_name(file)
|
||||
ulid := rand.ulid()
|
||||
vfmt_output_path := os.join_path(vtmp_folder, 'vfmt_${ulid}_$file_name')
|
||||
os.write_file(vfmt_output_path, formatted_content) or { panic(err.msg) }
|
||||
os.write_file(vfmt_output_path, formatted_content) or { panic(err) }
|
||||
if foptions.is_verbose {
|
||||
eprintln('fmt.fmt worked and $formatted_content.len bytes were written to $vfmt_output_path .')
|
||||
}
|
||||
@ -266,7 +266,7 @@ fn (foptions &FormatOptions) post_process_file(file string, formatted_file_path
|
||||
}
|
||||
if foptions.is_w {
|
||||
if is_formatted_different {
|
||||
os.mv_by_cp(formatted_file_path, file) or { panic(err.msg) }
|
||||
os.mv_by_cp(formatted_file_path, file) or { panic(err) }
|
||||
eprintln('Reformatted file: $file')
|
||||
} else {
|
||||
eprintln('Already formatted file: $file')
|
||||
@ -277,7 +277,7 @@ fn (foptions &FormatOptions) post_process_file(file string, formatted_file_path
|
||||
}
|
||||
|
||||
fn (f FormatOptions) str() string {
|
||||
return
|
||||
return
|
||||
'FormatOptions{ is_l: $f.is_l, is_w: $f.is_w, is_diff: $f.is_diff, is_verbose: $f.is_verbose,' +
|
||||
' is_all: $f.is_all, is_worker: $f.is_worker, is_debug: $f.is_debug, is_noerror: $f.is_noerror,' +
|
||||
' is_verify: $f.is_verify" }'
|
||||
@ -312,7 +312,7 @@ fn get_compile_name_of_potential_v_project(file string) string {
|
||||
pfolder := os.real_path(os.dir(file))
|
||||
// a .v project has many 'module main' files in one folder
|
||||
// if there is only one .v file, then it must be a standalone
|
||||
all_files_in_pfolder := os.ls(pfolder) or { panic(err.msg) }
|
||||
all_files_in_pfolder := os.ls(pfolder) or { panic(err) }
|
||||
mut vfiles := []string{}
|
||||
for f in all_files_in_pfolder {
|
||||
vf := os.join_path(pfolder, f)
|
||||
@ -332,7 +332,7 @@ fn get_compile_name_of_potential_v_project(file string) string {
|
||||
// a project folder, that should be compiled with `v pfolder`.
|
||||
mut main_fns := 0
|
||||
for f in vfiles {
|
||||
slines := read_source_lines(f) or { panic(err.msg) }
|
||||
slines := read_source_lines(f) or { panic(err) }
|
||||
for line in slines {
|
||||
if line.contains('fn main()') {
|
||||
main_fns++
|
||||
|
@ -71,7 +71,7 @@ fn main() {
|
||||
'install' {
|
||||
if module_names.len == 0 && os.exists('./v.mod') {
|
||||
println('Detected v.mod file inside the project directory. Using it...')
|
||||
manifest := vmod.from_file('./v.mod') or { panic(err.msg) }
|
||||
manifest := vmod.from_file('./v.mod') or { panic(err) }
|
||||
module_names = manifest.dependencies
|
||||
}
|
||||
vpm_install(module_names)
|
||||
@ -331,13 +331,13 @@ fn vpm_remove(module_names []string) {
|
||||
final_module_path := valid_final_path_of_existing_module(name) or { continue }
|
||||
println('Removing module "$name"...')
|
||||
verbose_println('removing folder $final_module_path')
|
||||
os.rmdir_all(final_module_path) or { panic(err.msg) }
|
||||
os.rmdir_all(final_module_path) or { panic(err) }
|
||||
// delete author directory if it is empty
|
||||
author := name.split('.')[0]
|
||||
author_dir := os.real_path(os.join_path(settings.vmodules_path, author))
|
||||
if os.is_dir_empty(author_dir) {
|
||||
verbose_println('removing author folder $author_dir')
|
||||
os.rmdir(author_dir) or { panic(err.msg) }
|
||||
os.rmdir(author_dir) or { panic(err) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -364,7 +364,7 @@ fn valid_final_path_of_existing_module(name string) ?string {
|
||||
fn ensure_vmodules_dir_exist() {
|
||||
if !os.is_dir(settings.vmodules_path) {
|
||||
println('Creating $settings.vmodules_path/ ...')
|
||||
os.mkdir(settings.vmodules_path) or { panic(err.msg) }
|
||||
os.mkdir(settings.vmodules_path) or { panic(err) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -411,7 +411,7 @@ fn get_installed_modules() []string {
|
||||
|
||||
fn get_all_modules() []string {
|
||||
url := get_working_server_url()
|
||||
r := http.get(url) or { panic(err.msg) }
|
||||
r := http.get(url) or { panic(err) }
|
||||
if r.status_code != 200 {
|
||||
println('Failed to search vpm.vlang.io. Status code: $r.status_code')
|
||||
exit(1)
|
||||
|
@ -184,7 +184,7 @@ fn run_repl(workdir string, vrepl_prefix string) {
|
||||
}
|
||||
if r.line.starts_with('print') {
|
||||
source_code := r.current_source_code(false) + '\n$r.line\n'
|
||||
os.write_file(file, source_code) or { panic(err.msg) }
|
||||
os.write_file(file, source_code) or { panic(err) }
|
||||
s := repl_run_vfile(file) or { return }
|
||||
print_output(s)
|
||||
} else {
|
||||
@ -251,7 +251,7 @@ fn run_repl(workdir string, vrepl_prefix string) {
|
||||
}
|
||||
temp_source_code = r.current_source_code(true) + '\n$temp_line\n'
|
||||
}
|
||||
os.write_file(temp_file, temp_source_code) or { panic(err.msg) }
|
||||
os.write_file(temp_file, temp_source_code) or { panic(err) }
|
||||
s := repl_run_vfile(temp_file) or { return }
|
||||
if !func_call && s.exit_code == 0 && !temp_flag {
|
||||
for r.temp_lines.len > 0 {
|
||||
|
@ -27,12 +27,12 @@ fn main() {
|
||||
// The user just wants an independent copy of v, and so we are done.
|
||||
return
|
||||
}
|
||||
backup_old_version_and_rename_newer() or { panic(err.msg) }
|
||||
backup_old_version_and_rename_newer() or { panic(err) }
|
||||
println('V built successfully!')
|
||||
}
|
||||
|
||||
fn compile(vroot string, cmd string) {
|
||||
result := os.exec(cmd) or { panic(err.msg) }
|
||||
result := os.exec(cmd) or { panic(err) }
|
||||
if result.exit_code != 0 {
|
||||
eprintln('cannot compile to `$vroot`: \n$result.output')
|
||||
exit(1)
|
||||
@ -76,7 +76,7 @@ fn backup_old_version_and_rename_newer() ?bool {
|
||||
os.rm(v_file) or { }
|
||||
|
||||
list_folder('', 'moving $v2_file to $v_file ...')
|
||||
os.mv_by_cp(v2_file, v_file) or { panic(err.msg) }
|
||||
os.mv_by_cp(v2_file, v_file) or { panic(err) }
|
||||
|
||||
list_folder('after:', '')
|
||||
|
||||
|
@ -12,7 +12,7 @@ fn main() {
|
||||
println('Thirdparty "freetype" is already installed.')
|
||||
} else {
|
||||
s := os.exec('git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries ./thirdparty/freetype/') or {
|
||||
panic(err.msg)
|
||||
panic(err)
|
||||
}
|
||||
println(s.output)
|
||||
println('Thirdparty "freetype" installed successfully.')
|
||||
|
@ -27,11 +27,11 @@ fn setup_symlink_unix(vexe string) {
|
||||
if os.system("uname -o | grep -q '[A/a]ndroid'") == 1 {
|
||||
link_dir := '/usr/local/bin'
|
||||
if !os.exists(link_dir) {
|
||||
os.mkdir_all(link_dir) or { panic(err.msg) }
|
||||
os.mkdir_all(link_dir) or { panic(err) }
|
||||
}
|
||||
link_path = link_dir + '/v'
|
||||
}
|
||||
ret := os.exec('ln -sf $vexe $link_path') or { panic(err.msg) }
|
||||
ret := os.exec('ln -sf $vexe $link_path') or { panic(err) }
|
||||
if ret.exit_code == 0 {
|
||||
println('Symlink "$link_path" has been created')
|
||||
} else {
|
||||
@ -49,14 +49,14 @@ fn setup_symlink_windows(vexe string) {
|
||||
mut vsymlink := os.join_path(vsymlinkdir, 'v.exe')
|
||||
// Remove old symlink first (v could have been moved, symlink rerun)
|
||||
if !os.exists(vsymlinkdir) {
|
||||
os.mkdir(vsymlinkdir) or { panic(err.msg) }
|
||||
os.mkdir(vsymlinkdir) or { panic(err) }
|
||||
} else {
|
||||
if os.exists(vsymlink) {
|
||||
os.rm(vsymlink) or { panic(err.msg) }
|
||||
os.rm(vsymlink) or { panic(err) }
|
||||
} else {
|
||||
vsymlink = os.join_path(vsymlinkdir, 'v.bat')
|
||||
if os.exists(vsymlink) {
|
||||
os.rm(vsymlink) or { panic(err.msg) }
|
||||
os.rm(vsymlink) or { panic(err) }
|
||||
}
|
||||
vsymlink = os.join_path(vsymlinkdir, 'v.exe')
|
||||
}
|
||||
@ -69,9 +69,9 @@ fn setup_symlink_windows(vexe string) {
|
||||
eprintln('Creating a batch file instead...')
|
||||
vsymlink = os.join_path(vsymlinkdir, 'v.bat')
|
||||
if os.exists(vsymlink) {
|
||||
os.rm(vsymlink) or { panic(err.msg) }
|
||||
os.rm(vsymlink) or { panic(err) }
|
||||
}
|
||||
os.write_file(vsymlink, '@echo off\n$vexe %*') or { panic(err.msg) }
|
||||
os.write_file(vsymlink, '@echo off\n$vexe %*') or { panic(err) }
|
||||
eprintln('$vsymlink file written.')
|
||||
}
|
||||
if !os.exists(vsymlink) {
|
||||
|
@ -41,7 +41,7 @@ fn main() {
|
||||
app.backup('cmd/tools/vup.exe')
|
||||
}
|
||||
app.recompile_v()
|
||||
os.exec('"$app.vexe" cmd/tools/vup.v') or { panic(err.msg) }
|
||||
os.exec('"$app.vexe" cmd/tools/vup.v') or { panic(err) }
|
||||
app.show_current_v_version()
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ fn (app App) make(vself string) {
|
||||
$if windows {
|
||||
make = 'make.bat'
|
||||
}
|
||||
make_result := os.exec(make) or { panic(err.msg) }
|
||||
make_result := os.exec(make) or { panic(err) }
|
||||
app.vprintln(make_result.output)
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ fn (app App) git_command(command string) {
|
||||
git_result := os.exec('git $command') or {
|
||||
app.get_git()
|
||||
// Try it again with (maybe) git installed
|
||||
os.exec('git $command') or { panic(err.msg) }
|
||||
os.exec('git $command') or { panic(err) }
|
||||
}
|
||||
if git_result.exit_code != 0 {
|
||||
eprintln(git_result.output)
|
||||
@ -136,11 +136,11 @@ fn (app App) get_git() {
|
||||
// We'll use 32 bit because maybe someone out there is using 32-bit windows
|
||||
os.exec('bitsadmin.exe /transfer "vgit" https://github.com/git-for-windows/git/releases/download/v2.30.0.windows.2/Git-2.30.0.2-32-bit.exe "$os.getwd()/git32.exe"') or {
|
||||
eprintln('Unable to install git automatically: please install git manually')
|
||||
panic(err.msg)
|
||||
panic(err)
|
||||
}
|
||||
os.exec('$os.getwd()/git32.exe') or {
|
||||
eprintln('Unable to install git automatically: please install git manually')
|
||||
panic(err.msg)
|
||||
panic(err)
|
||||
}
|
||||
} $else { // Probably some kind of *nix, usually need to get using a package manager.
|
||||
eprintln("error: Install `git` using your system's package manager")
|
||||
|
@ -21,7 +21,7 @@ fn test_vet() {
|
||||
}
|
||||
|
||||
fn get_tests_in_dir(dir string) []string {
|
||||
files := os.ls(dir) or { panic(err.msg) }
|
||||
files := os.ls(dir) or { panic(err) }
|
||||
mut tests := files.filter(it.ends_with('.vv'))
|
||||
tests.sort()
|
||||
return tests
|
||||
@ -34,8 +34,8 @@ fn check_path(vexe string, dir string, tests []string) int {
|
||||
program := path
|
||||
print(path + ' ')
|
||||
// -force is needed so that `v vet` would not skip the regression files
|
||||
res := os.exec('$vexe vet -force $program') or { panic(err.msg) }
|
||||
mut expected := os.read_file(program.replace('.vv', '') + '.out') or { panic(err.msg) }
|
||||
res := os.exec('$vexe vet -force $program') or { panic(err) }
|
||||
mut expected := os.read_file(program.replace('.vv', '') + '.out') or { panic(err) }
|
||||
expected = clean_line_endings(expected)
|
||||
found := clean_line_endings(res.output)
|
||||
if expected != found {
|
||||
|
Reference in New Issue
Block a user