mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builder: support -o - to print the generated C/JS source to stdout
This commit is contained in:
@@ -479,6 +479,13 @@ fn (mut v Builder) cc() {
|
||||
}
|
||||
return
|
||||
}
|
||||
if v.pref.out_name.ends_with('/-') {
|
||||
// output to stdout
|
||||
content := os.read_file(v.out_name_c) or { panic(err) }
|
||||
println(content)
|
||||
os.rm(v.out_name_c) or {}
|
||||
return
|
||||
}
|
||||
// whether to just create a .c or .js file and exit, for example: `v -o v.c cmd.v`
|
||||
ends_with_c := v.pref.out_name.ends_with('.c')
|
||||
ends_with_js := v.pref.out_name.ends_with('.js')
|
||||
|
||||
Reference in New Issue
Block a user