Commit ecf3857
Michael Sakaluk
·
2026-03-12 23:02:53 -0400 EDT
parent 49b126a
fix: print error to stderr when session does not exist (#88)
1 files changed,
+10,
-4
+10,
-4
| ... | ... | @@ -884,8 +884,11 @@ fn kill(cfg: *Cfg, session_name: []const u8) !void { | |
| 884 | 884 | ||
| 885 | 885 | const exists = try socket.sessionExists(dir, session_name); | |
| 886 | 886 | if (!exists) { | |
| 887 | - | std.log.err("cannot kill session because it does not exist session_name={s}", .{session_name}); | |
| 888 | - | return; | |
| 887 | + | var buf: [4096]u8 = undefined; | |
| 888 | + | var w = std.fs.File.stderr().writer(&buf); | |
| 889 | + | w.interface.print("error: session \"{s}\" does not exist\n", .{session_name}) catch {}; | |
| 890 | + | w.interface.flush() catch {}; | |
| 891 | + | return error.SessionNotFound; | |
| 889 | 892 | } | |
| 890 | 893 | ||
| 891 | 894 | const socket_path = try socket.getSocketPath(alloc, cfg.socket_dir, session_name); |
| ... | ... | @@ -925,8 +928,11 @@ fn history(cfg: *Cfg, session_name: []const u8, format: util.HistoryFormat) !voi | |
| 925 | 928 | ||
| 926 | 929 | const exists = try socket.sessionExists(dir, session_name); | |
| 927 | 930 | if (!exists) { | |
| 928 | - | std.log.err("session does not exist session_name={s}", .{session_name}); | |
| 929 | - | return; | |
| 931 | + | var buf: [4096]u8 = undefined; | |
| 932 | + | var w = std.fs.File.stderr().writer(&buf); | |
| 933 | + | w.interface.print("error: session \"{s}\" does not exist\n", .{session_name}) catch {}; | |
| 934 | + | w.interface.flush() catch {}; | |
| 935 | + | return error.SessionNotFound; | |
| 930 | 936 | } | |
| 931 | 937 | ||
| 932 | 938 | const socket_path = try socket.getSocketPath(alloc, cfg.socket_dir, session_name); |