aboutsummaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-12-02 23:39:33 +0000
committergingerBill <bill@gingerbill.org>2020-12-02 23:39:33 +0000
commit0cf3ae93c052e33984cc73a557a8a8cdd411ad0e (patch)
tree8c0ca080177ab22e548ebe05e4ad29a212c4efb1 /core/io
parentc4172e391443a021e43ff55938b86637eec4e1d2 (diff)
Add `os.stream_from_handle`; fix `io.close`
Diffstat (limited to 'core/io')
-rw-r--r--core/io/io.odin5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/io/io.odin b/core/io/io.odin
index 7aca6e25f..47363bd28 100644
--- a/core/io/io.odin
+++ b/core/io/io.odin
@@ -113,11 +113,12 @@ Rune_Scanner :: struct {using stream: Stream};
destroy :: proc(s: Stream) -> Error {
+ close_err := close({s});
if s.stream_vtable != nil && s.impl_destroy != nil {
return s->impl_destroy();
}
// Instead of .Empty, .None is fine in this case
- return .None;
+ return close_err;
}
read :: proc(s: Reader, p: []byte) -> (n: int, err: Error) {
@@ -141,7 +142,7 @@ seek :: proc(s: Seeker, offset: i64, whence: Seek_From) -> (n: i64, err: Error)
return 0, .Empty;
}
-close :: proc(s: Closer, p: []byte) -> Error {
+close :: proc(s: Closer) -> Error {
if s.stream_vtable != nil && s.impl_close != nil {
return s->impl_close();
}