Skip to content

Commit 52c02e2

Browse files
authored
Merge pull request #481 from savi-lang/add/env-out-flush
Call `pony_os_stdout_setup` at the start of a Savi program.
2 parents 5fff3e0 + 4cd6dff commit 52c02e2

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

core/Env.savi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
argv CPointer(CPointer(U8)'ref)'ref
1818
envp CPointer(CPointer(U8)'ref)'ref
1919
)
20+
// This sets up proper buffering for stdout and stderr.
21+
// Without this, program output piped to files may behave poorly.
22+
_FFI.pony_os_stdout_setup
23+
2024
@args = []
2125
i = USize[0]
2226
while argc > 0 (

core/_FFI.savi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
:ffi variadic snprintf(buffer CPointer(U8), buffer_size I32, fmt CPointer(U8)) I32
66

77
:ffi pony_exitcode(code I32) None
8+
:ffi pony_os_stdout_setup() None
89
:ffi pony_os_stdout() CPointer(None)'ref
910
:ffi pony_os_stderr() CPointer(None)'ref
1011
:ffi pony_os_std_print(

0 commit comments

Comments
 (0)