Commit Graph

4 Commits

Author SHA1 Message Date
Bob Nystrom
42ba73b03b feat: add stat instance method to File class returning Stat object
Implement `File.stat` method that performs an asynchronous `fstat` call on the open file descriptor, returning a `Stat` object populated with file metadata (device, inode, mode, link count, user, group, size, block size, block count). Refactor the existing `statPathCallback` into a generic `statCallback` shared by both `statPath` and the new `fileStat` function. Bump `MAX_METHODS_PER_CLASS` from 11 to 12 to accommodate the new foreign method slot. Add comprehensive test coverage including successful stat retrieval and error handling when called on a closed file.
2016-02-21 18:18:45 +00:00
Bob Nystrom
f112722d00 feat: add File.stat() method and Stat class for filesystem metadata queries
Implement asynchronous stat() on File class returning a new Stat object with device, inode, mode, linkCount, user, group, specialDevice, size, blockSize, and blockCount fields populated from libuv uv_fs_stat callback. Register foreign method statPath_ in module registry, bump MAX_METHODS_PER_CLASS to 10, add Stat class to io.wren with indexed field accessors, update documentation index with Stat page, and include test coverage for stat on existing file and nonexistent path.
2016-01-01 17:58:44 +00:00
Bob Nystrom
8fd9449196 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.
2015-10-01 04:13:36 +00:00
Bob Nystrom
e4cac681a5 feat: add io module with File.size async stat and scheduler resume helpers
Introduce a new built-in "io" module exposing a File class with a static size(path) method that performs asynchronous filesystem stat via libuv. The method uses a foreign function startSize_ to initiate the stat request and resumes the calling fiber through the scheduler upon completion. Extend the scheduler with schedulerResumeDouble and schedulerResumeString to support resuming fibers with numeric or string results. Include the generated io.wren.inc source, update the Xcode project to compile io.c and io.wren.inc, register the module in modules.c, and add a test file verifying synchronous-style async size calls and error handling.
2015-09-16 14:34:49 +00:00