mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: add execute_or_exit(cmd), use it consistently instead of execute_or_panic(cmd)
This commit is contained in:
@ -107,7 +107,7 @@ fn main() {
|
||||
}
|
||||
|
||||
fn exec(s string) string {
|
||||
e := os.execute_or_panic(s)
|
||||
e := os.execute_or_exit(s)
|
||||
return e.output.trim_right('\r\n')
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ fn measure(cmd string, description string) int {
|
||||
}
|
||||
|
||||
fn measure_steps(vdir string) (int, int, int, int, int) {
|
||||
resp := os.execute_or_panic('$vdir/vprod $voptions -o v.c cmd/v')
|
||||
resp := os.execute_or_exit('$vdir/vprod $voptions -o v.c cmd/v')
|
||||
|
||||
mut scan, mut parse, mut check, mut cgen, mut vlines := 0, 0, 0, 0, 0
|
||||
lines := resp.output.split_into_lines()
|
||||
|
@ -32,7 +32,7 @@ fn main() {
|
||||
println('resp != 0, skipping')
|
||||
} else {
|
||||
os.chdir('website')
|
||||
os.execute_or_panic('git checkout gh-pages')
|
||||
os.execute_or_exit('git checkout gh-pages')
|
||||
os.cp('../index.html', 'index.html') ?
|
||||
os.system('git commit -am "update benchmark"')
|
||||
os.system('git push origin gh-pages')
|
||||
|
@ -165,7 +165,7 @@ fn main() {
|
||||
scripting.cprintln('# v commit hash: $shorter_hash | folder: $context.path_v')
|
||||
if context.cmd_to_run.len > 0 {
|
||||
scripting.cprintln_strong('# command: ${context.cmd_to_run:-34s}')
|
||||
cmdres := os.execute_or_panic(context.cmd_to_run)
|
||||
cmdres := os.execute_or_exit(context.cmd_to_run)
|
||||
if cmdres.exit_code != 0 {
|
||||
scripting.cprintln_strong('# exit code: ${cmdres.exit_code:-4d}')
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ const test_path = 'vcreate_test'
|
||||
|
||||
fn init_and_check() ? {
|
||||
vexe := @VEXE
|
||||
os.execute_or_panic('$vexe init')
|
||||
os.execute_or_exit('$vexe init')
|
||||
|
||||
assert os.read_file('vcreate_test.v') ? == [
|
||||
'module main\n',
|
||||
@ -58,7 +58,7 @@ fn test_v_init_in_git_dir() ? {
|
||||
os.rmdir_all(dir) or {}
|
||||
}
|
||||
os.chdir(dir)
|
||||
os.execute_or_panic('git init .')
|
||||
os.execute_or_exit('git init .')
|
||||
init_and_check() ?
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ fn test_v_init_no_overwrite_gitignore() ? {
|
||||
os.chdir(dir)
|
||||
|
||||
vexe := @VEXE
|
||||
os.execute_or_panic('$vexe init')
|
||||
os.execute_or_exit('$vexe init')
|
||||
|
||||
assert os.read_file('.gitignore') ? == 'blah'
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ fn main() {
|
||||
}
|
||||
|
||||
fn compile(vroot string, cmd string) {
|
||||
result := os.execute_or_panic(cmd)
|
||||
result := os.execute_or_exit(cmd)
|
||||
if result.exit_code != 0 {
|
||||
eprintln('cannot compile to `$vroot`: \n$result.output')
|
||||
exit(1)
|
||||
|
@ -135,7 +135,7 @@ fn (app App) git_command(command string) {
|
||||
if git_result.exit_code < 0 {
|
||||
app.get_git()
|
||||
// Try it again with (maybe) git installed
|
||||
os.execute_or_panic('git $command')
|
||||
os.execute_or_exit('git $command')
|
||||
}
|
||||
if git_result.exit_code != 0 {
|
||||
eprintln(git_result.output)
|
||||
|
Reference in New Issue
Block a user