summaryrefslogtreecommitdiff
path: root/src/texec/libtnsl.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/texec/libtnsl.go')
-rw-r--r--src/texec/libtnsl.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/texec/libtnsl.go b/src/texec/libtnsl.go
index 581d15e..bb0ce7d 100644
--- a/src/texec/libtnsl.go
+++ b/src/texec/libtnsl.go
@@ -176,8 +176,11 @@ func tfile_close(file TVariable) {
// tnsl.io.File.read
func tfile_read(file TVariable) TVariable {
b := []byte{1}
- (file.Data).(*os.File).Read(b)
- return TVariable{tCharp, b[0]}
+ _, err := (file.Data).(*os.File).Read(b)
+ if err != nil {
+ return TVariable{tInt, -1}
+ }
+ return TVariable{tInt, int(b[0])}
}
// tnsl.io.File.write