diff --git a/vlib/builtin/builtin.v b/vlib/builtin/builtin.v index 743ac360e0..f88b8ba236 100644 --- a/vlib/builtin/builtin.v +++ b/vlib/builtin/builtin.v @@ -54,7 +54,7 @@ pub fn print_backtrace_skipping_top_frames(skipframes int) { cmd := 'addr2line -e $executable $addr' // taken from os, to avoid depending on the os module inside builtin.v - f := byteptr(C.popen(cmd.str, 'r')) + f := C.popen(cmd.str, 'r') if isnil(f) { println(sframe) continue } diff --git a/vlib/builtin/cfns.v b/vlib/builtin/cfns.v index 3a0171200d..7ce581cbfb 100644 --- a/vlib/builtin/cfns.v +++ b/vlib/builtin/cfns.v @@ -14,11 +14,12 @@ fn C.sprintf(a ...voidptr) byteptr fn C.strlen(s byteptr) int fn C.isdigit(s byteptr) bool - - +// stdio.h +fn C.popen(c byteptr, t byteptr) voidptr // fn backtrace(a voidptr, b int) int +fn backtrace_symbols(voidptr, int) &byteptr fn backtrace_symbols_fd(voidptr, int, int) // diff --git a/vlib/os/os.v b/vlib/os/os.v index 5d4ddd7fa8..e05d47c344 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -282,7 +282,7 @@ pub fn (f File) close() { } // system starts the specified command, waits for it to complete, and returns its code. -fn popen(path string) *C.FILE { +fn vpopen(path string) *C.FILE { $if windows { mode := 'rb' wpath := path.to_wide() @@ -313,7 +313,7 @@ fn posix_wait4_to_exit_status(waitret int) (int,bool) { } } -fn pclose(f *C.FILE) int { +fn vpclose(f *C.FILE) int { $if windows { return int( C._pclose(f) ) } @@ -333,7 +333,7 @@ pub: // exec starts the specified command, waits for it to complete, and returns its output. pub fn exec(cmd string) ?Result { pcmd := '$cmd 2>&1' - f := popen(pcmd) + f := vpopen(pcmd) if isnil(f) { return error('exec("$cmd") failed') } @@ -343,7 +343,7 @@ pub fn exec(cmd string) ?Result { res += tos(buf, vstrlen(buf)) } res = res.trim_space() - exit_code := pclose(f) + exit_code := vpclose(f) //if exit_code != 0 { //return error(res) //}