repos / zmx

session persistence for terminal processes
git clone https://github.com/neurosnap/zmx.git

commit
ecf3857
parent
49b126a
author
Michael Sakaluk
date
2026-03-12 23:02:53 -0400 EDT
fix: print error to stderr when session does not exist (#88)
1 files changed,  +10, -4
M src/main.zig
+10, -4
 1@@ -884,8 +884,11 @@ fn kill(cfg: *Cfg, session_name: []const u8) !void {
 2 
 3     const exists = try socket.sessionExists(dir, session_name);
 4     if (!exists) {
 5-        std.log.err("cannot kill session because it does not exist session_name={s}", .{session_name});
 6-        return;
 7+        var buf: [4096]u8 = undefined;
 8+        var w = std.fs.File.stderr().writer(&buf);
 9+        w.interface.print("error: session \"{s}\" does not exist\n", .{session_name}) catch {};
10+        w.interface.flush() catch {};
11+        return error.SessionNotFound;
12     }
13 
14     const socket_path = try socket.getSocketPath(alloc, cfg.socket_dir, session_name);
15@@ -925,8 +928,11 @@ fn history(cfg: *Cfg, session_name: []const u8, format: util.HistoryFormat) !voi
16 
17     const exists = try socket.sessionExists(dir, session_name);
18     if (!exists) {
19-        std.log.err("session does not exist session_name={s}", .{session_name});
20-        return;
21+        var buf: [4096]u8 = undefined;
22+        var w = std.fs.File.stderr().writer(&buf);
23+        w.interface.print("error: session \"{s}\" does not exist\n", .{session_name}) catch {};
24+        w.interface.flush() catch {};
25+        return error.SessionNotFound;
26     }
27 
28     const socket_path = try socket.getSocketPath(alloc, cfg.socket_dir, session_name);