aboutsummaryrefslogtreecommitdiff
path: root/src/IncrementalDebugServer.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-08-29 03:48:45 -0700
committerGitHub <noreply@github.com>2025-08-29 03:48:45 -0700
commit4b948e8556b80cbc874415aa7c4bf9ac0027ffed (patch)
treeca48e7208aa23a24db82e8521c37a6c2abcd5dc1 /src/IncrementalDebugServer.zig
parent640c11171bf8d13776629941f3305cf11c62c1f3 (diff)
parent43fbc37a490442ffcecf9817877f542251fee664 (diff)
downloadzig-4b948e8556b80cbc874415aa7c4bf9ac0027ffed.tar.gz
zig-4b948e8556b80cbc874415aa7c4bf9ac0027ffed.zip
Merge pull request #25036 from ziglang/GenericWriter
std.Io: delete GenericWriter, AnyWriter, and null_writer
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")) {