1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builtin: fix termux prints (#9921)

This commit is contained in:
Thomas Treffner 2021-04-29 08:49:26 +02:00 committed by GitHub
parent b406de20df
commit e05da04b4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,14 +119,13 @@ pub fn eprintln(s string) {
} else {
C.fprintf(C.stderr, c'%.*s\n', s.len, s.str)
}
} $else {
}
if s.str == 0 {
_ = C.write(2, c'eprintln(NIL)\n', 14)
} else {
_ = C.write(2, s.str, s.len)
_ = C.write(2, c'\n', 1)
}
}
C.fflush(C.stderr)
}
}
@ -156,13 +155,12 @@ pub fn eprint(s string) {
} else {
C.fprintf(C.stderr, c'%.*s', s.len, s.str)
}
} $else {
}
if s.str == 0 {
_ = C.write(2, c'eprint(NIL)', 11)
} else {
_ = C.write(2, s.str, s.len)
}
}
C.fflush(C.stderr)
}
}
@ -172,7 +170,8 @@ pub fn eprint(s string) {
pub fn print(s string) {
$if android {
C.fprintf(C.stdout, c'%.*s', s.len, s.str)
} $else $if ios {
}
$if ios {
// TODO: Implement a buffer as NSLog doesn't have a "print"
C.WrappedNSLog(s.str)
} $else $if freestanding {