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

v repl: fix println regression on linux

This commit is contained in:
Delyan Angelov
2020-01-05 23:49:09 +02:00
committed by Alexander Medvednikov
parent 8053175ead
commit 4c3df963fa
2 changed files with 23 additions and 21 deletions

View File

@@ -21,14 +21,16 @@ const (
fn C.puts(charptr)
*/
pub fn println(s string) {
$if linux {
$if !android {
snl := s + '\n'
C.syscall(/* sys_write */ 1, /* stdout_value */ 1, snl.str, s.len+1)
return
}
}
pub fn println(s string) {
// TODO: a syscall sys_write on linux works, except for the v repl.
// Probably it is a stdio buffering issue. Needs more testing...
// $if linux {
// $if !android {
// snl := s + '\n'
// C.syscall(/* sys_write */ 1, /* stdout_value */ 1, snl.str, s.len+1)
// return
// }
// }
C.printf('%.*s\n', s.len, s.str)
}