feat: implement async file I/O with open/close/readBytes and scheduler error handling

Add foreign class File with static open, read, size methods and instance methods for close, size, readBytes. Implement async file operations using libuv callbacks that resume fibers on completion. Introduce schedulerResumeError and resumeError_ to propagate I/O errors as fiber errors. Add setExitCode to CLI vm for runtime error exit handling. Bump MAX_METHODS_PER_CLASS from 2 to 9 to accommodate new File methods.
This commit is contained in:
Bob Nystrom
2015-10-01 04:13:36 +00:00
parent af90291f6f
commit 8fd9449196
32 changed files with 475 additions and 44 deletions
+11
View File
@@ -0,0 +1,11 @@
import "io" for File
var file = File.open("test/io/file/descriptor.wren")
// We can't test for a specific value since it's up to the OS, but it should be
// a positive number.
System.print(file.descriptor is Num) // expect: true
System.print(file.descriptor > 0) // expect: true
file.close()
System.print(file.descriptor) // expect: -1