Skip to content

Commit ba86d61

Browse files
authored
builtin: fix print/println on termux (#10253)
1 parent b29bc9c commit ba86d61

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

vlib/builtin/builtin.c.v

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,10 @@ pub fn eprint(s string) {
164164
// print prints a message to stdout. Unlike `println` stdout is not automatically flushed.
165165
// A call to `flush()` will flush the output buffer to stdout.
166166
pub fn print(s string) {
167-
$if android {
167+
$if android { // android print for logcat
168168
C.fprintf(C.stdout, c'%.*s', s.len, s.str)
169-
} $else $if ios {
169+
}
170+
$if ios { // no else if because we also need console output on android
170171
// TODO: Implement a buffer as NSLog doesn't have a "print"
171172
C.WrappedNSLog(s.str)
172173
} $else $if freestanding {
@@ -190,9 +191,10 @@ pub fn println(s string) {
190191
}
191192
return
192193
}
193-
$if android {
194+
$if android { // android print for logcat
194195
C.fprintf(C.stdout, c'%.*s\n', s.len, s.str)
195-
} $else $if ios {
196+
}
197+
$if ios { // no else if because we also need console output on android
196198
C.WrappedNSLog(s.str)
197199
} $else $if freestanding {
198200
bare_print(s.str, u64(s.len))

0 commit comments

Comments
 (0)