aboutsummaryrefslogtreecommitdiff
path: root/src/IncrementalDebugServer.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-08-16 20:01:46 -0700
committerAndrew Kelley <andrew@ziglang.org>2025-08-28 18:30:57 -0700
commit379d7bc9f64e64818f31520700294f778aa13690 (patch)
tree1828ce69a4bc7188b55ba3856b54f8639a50c321 /src/IncrementalDebugServer.zig
parent6713745ec4f76d133eb0d5066c40bba666d0a194 (diff)
downloadzig-379d7bc9f64e64818f31520700294f778aa13690.tar.gz
zig-379d7bc9f64e64818f31520700294f778aa13690.zip
compiler: update to not use GenericWriter
Diffstat (limited to 'src/IncrementalDebugServer.zig')
-rw-r--r--src/IncrementalDebugServer.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/IncrementalDebugServer.zig b/src/IncrementalDebugServer.zig
index e5fcb71424..358b1a4327 100644
--- a/src/IncrementalDebugServer.zig
+++ b/src/IncrementalDebugServer.zig
@@ -76,7 +76,9 @@ fn runThread(ids: *IncrementalDebugServer) void {
ids.mutex.lock();
}
defer ids.mutex.unlock();
- handleCommand(ids.zcu, &text_out, cmd, arg) catch @panic("IncrementalDebugServer: out of memory");
+ var allocating: std.Io.Writer.Allocating = .fromArrayList(gpa, &text_out);
+ defer text_out = allocating.toArrayList();
+ handleCommand(ids.zcu, &allocating.writer, cmd, arg) catch @panic("IncrementalDebugServer: out of memory");
}
text_out.append(gpa, '\n') catch @panic("IncrementalDebugServer: out of memory");
conn.stream.writeAll(text_out.items) catch @panic("IncrementalDebugServer: failed to write");
@@ -119,10 +121,8 @@ const help_str: []const u8 =
\\
;
-fn handleCommand(zcu: *Zcu, output: *std.ArrayListUnmanaged(u8), cmd_str: []const u8, arg_str: []const u8) Allocator.Error!void {
+fn handleCommand(zcu: *Zcu, w: *std.Io.Writer, cmd_str: []const u8, arg_str: []const u8) error{ WriteFailed, OutOfMemory }!void {
const ip = &zcu.intern_pool;
- const gpa = zcu.gpa;
- const w = output.writer(gpa);
if (std.mem.eql(u8, cmd_str, "help")) {
try w.writeAll(help_str);
} else if (std.mem.eql(u8, cmd_str, "summary")) {