builtin: fix termux prints (#10595)

pull/10597/head
Thomas Treffner 2021-06-28 07:27:12 +02:00 committed by GitHub
parent 4bed4afef7
commit 9651a9796b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 9 deletions

View File

@ -141,10 +141,10 @@ pub fn eprint(s string) {
[manualfree]
pub fn print(s string) {
$if android {
// android print for logcat
C.fprintf(C.stdout, c'%.*s', s.len, s.str)
_write_buf_to_fd(1, s.str, s.len)
} $else $if ios {
C.fprintf(C.stdout, c'%.*s', s.len, s.str) // logcat
}
// no else if for android termux support
$if ios {
// TODO: Implement a buffer as NSLog doesn't have a "print"
C.WrappedNSLog(s.str)
} $else $if freestanding {
@ -161,14 +161,14 @@ pub fn println(s string) {
println('println(NIL)')
return
}
$if android {
C.fprintf(C.stdout, c'%.*s\n', s.len, s.str) // logcat
return
}
// no else if for android termux support
$if ios {
C.WrappedNSLog(s.str)
return
} $else $if android {
// android print for logcat
C.fprintf(C.stdout, c'%.*s\n', s.len, s.str)
_writeln_to_fd(1, s)
return
} $else $if freestanding {
bare_print(s.str, u64(s.len))
bare_print(c'\n', 1)