builtin: fix termux prints (#9921)

pull/9926/head
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
1 changed files with 13 additions and 14 deletions

View File

@ -119,13 +119,12 @@ 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)
}
}
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,12 +155,11 @@ 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)
}
}
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 {