Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

learn, list_dir: drop the Windows no-follow handle fix-up

justrach7247cde44384
diff --git a/src/learn_store.zig b/src/learn_store.zig
index bc4363cf..5a824ff2 100644
--- a/src/learn_store.zig
+++ b/src/learn_store.zig
@@ -57,19 +57,18 @@ pub fn syncDirectory(io: Io, dir: Io.Dir) !void {
try file.sync(io);
}
-/// Zig 0.16 opens Windows no-follow files asynchronously but marks the returned
-/// handle as blocking. Correct the flag so reads use the APC-aware path instead
-/// of treating a legitimate STATUS_PENDING result as unreachable.
+/// Open without following a symlink, beneath `dir` for a relative path. Zig
+/// 0.17.0 opens Windows no-follow files synchronously and flags them so; the
+/// development build opened them asynchronously, and the flag fix-up it needed
+/// would now send reads down the async path to wait forever.
fn openFileNoFollow(io: Io, dir: Io.Dir, path: []const u8, options: Io.Dir.OpenFileOptions) !Io.File {
var adjusted = options;
adjusted.follow_symlinks = false;
if (!std.fs.path.isAbsolute(path)) adjusted.resolve_beneath = true;
- var file = if (std.fs.path.isAbsolute(path))
- try Io.Dir.openFileAbsolute(io, path, adjusted)
+ return if (std.fs.path.isAbsolute(path))
+ Io.Dir.openFileAbsolute(io, path, adjusted)
else
- try dir.openFile(io, path, adjusted);
- if (builtin.os.tag == .windows) file.flags.nonblocking = true;
- return file;
+ dir.openFile(io, path, adjusted);
}
// Input validation lives in learn_store_validate.zig (600-line goal); the
diff --git a/src/list_dir.zig b/src/list_dir.zig
index 576c8ac4..005ca464 100644
--- a/src/list_dir.zig
+++ b/src/list_dir.zig
@@ -121,10 +121,6 @@ fn fill(w: *Walk, node: *Node, rel: []const u8) !void {
if (dir.openFile(w.io, ".gitignore", .{ .follow_symlinks = false })) |opened| {
var file = opened;
defer file.close(w.io);
- // Zig opens no-follow files asynchronously on Windows but marks the
- // returned handle synchronous. Positional reads need the actual mode
- // and an explicit offset; streaming reads on that handle fail.
- if (@import("builtin").os.tag == .windows) file.flags.nonblocking = true;
if ((try file.stat(w.io)).kind == .file) {
var buffer: [4096]u8 = undefined;
var reader = file.reader(w.io, &buffer);