wren-lang/wren-cli

io.Stdout.flush() ignores output errors rather than ensuring output buffers get written

guenther-brunthaler opened this issue · 1 comments

The fflush() C API call in stdoutFlush(WrenVM*) should check the return code and throw an exception if it is nonzero.

In particular

$ cat test.wren 
import "io" for Stdout
System.write("Hello, world!\n")
Stdout.flush()

$ wren-cli test.wren > /dev/full ; echo "return code = $?"
return code = 0

There is currently no error message to indicate the output error, nor a failure return code.