graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
fix(tui): judge the stderr-park syscalls by errno, not by sign
Rach Pradhan3386c93e6739
diff --git a/TUI/restore.zig b/TUI/restore.zigindex 58e8ddcd..042d040f 100644--- a/TUI/restore.zig+++ b/TUI/restore.zig@@ -149,13 +149,16 @@ pub fn muteStderr() void {.{ .ACCMODE = .WRONLY, .CREAT = true, .APPEND = true },0o644,) catch return;- const saved_fd = std.posix.system.dup(std.posix.STDERR_FILENO);- if (saved_fd < 0) {+ // The raw syscall layer returns usize on Linux and c_int through libc,+ // so success is judged by errno, not by the sign of the return.+ const saved_rc = std.posix.system.dup(std.posix.STDERR_FILENO);+ if (std.posix.errno(saved_rc) != .SUCCESS) {_ = std.posix.system.close(log);return;}- real_stderr = saved_fd;- if (std.posix.system.dup2(log, std.posix.STDERR_FILENO) < 0) {+ real_stderr = @intCast(saved_rc);+ const swap_rc = std.posix.system.dup2(log, std.posix.STDERR_FILENO);+ if (std.posix.errno(swap_rc) != .SUCCESS) {_ = std.posix.system.close(real_stderr);real_stderr = -1;}