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