ci: fix windows-tcc job
parent
3617ce0539
commit
19b915b105
|
@ -31,7 +31,7 @@ fn new_addr(addr C.sockaddr) ?Addr {
|
|||
// Convert to string representation
|
||||
buf := []byte{len: net.max_ipv4_addr_len, init: 0}
|
||||
$if windows {
|
||||
res := C.WSAAddressToStringA(&addr, addr_len, C.NULL, buf.data, &buf.len)
|
||||
res := C.WSAAddressToStringA(&addr, addr_len, C.NULL, buf.data, unsafe { &u32(&buf.len) })
|
||||
if res != 0 {
|
||||
socket_error(-1) ?
|
||||
}
|
||||
|
|
|
@ -170,19 +170,20 @@ pub fn execute(cmd string) Result {
|
|||
output: 'exec("$cmd") failed'
|
||||
}
|
||||
}
|
||||
buf := [4096]byte{}
|
||||
buf := unsafe { &char(malloc(4096)) }
|
||||
mut res := strings.new_builder(1024)
|
||||
defer {
|
||||
unsafe { res.free() }
|
||||
}
|
||||
unsafe {
|
||||
bufbp := &buf[0]
|
||||
for C.fgets(&char(bufbp), 4096, f) != 0 {
|
||||
bufbp := buf
|
||||
for C.fgets(bufbp, 4096, f) != 0 {
|
||||
res.write_ptr(bufbp, vstrlen(bufbp))
|
||||
}
|
||||
}
|
||||
soutput := res.str()
|
||||
exit_code := vpclose(f)
|
||||
unsafe { free(buf) }
|
||||
return Result{
|
||||
exit_code: exit_code
|
||||
output: soutput
|
||||
|
|
|
@ -69,14 +69,14 @@ pub fn color_compare_files(diff_cmd string, file1 string, file2 string) string {
|
|||
}
|
||||
|
||||
pub fn color_compare_strings(diff_cmd string, unique_prefix string, expected string, found string) string {
|
||||
cdir := os.cache_dir()
|
||||
cdir := os.join_path(os.cache_dir(), unique_prefix)
|
||||
os.mkdir(cdir) or {}
|
||||
ctime := time.sys_mono_now()
|
||||
e_file := os.join_path(cdir, '${unique_prefix}_${ctime}.expected.txt')
|
||||
f_file := os.join_path(cdir, '${unique_prefix}_${ctime}.found.txt')
|
||||
e_file := os.join_path(cdir, '${ctime}.expected.txt')
|
||||
f_file := os.join_path(cdir, '${ctime}.found.txt')
|
||||
os.write_file(e_file, expected) or { panic(err) }
|
||||
os.write_file(f_file, found) or { panic(err) }
|
||||
res := color_compare_files(diff_cmd, e_file, f_file)
|
||||
os.rm(e_file) or { panic(err) }
|
||||
os.rm(f_file) or { panic(err) }
|
||||
os.rmdir_all(cdir) or {}
|
||||
return res
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue