From cd0accfb287445d08b2d7967344a1155f808de08 Mon Sep 17 00:00:00 2001 From: AnErrupTion Date: Tue, 5 Aug 2025 08:26:13 +0200 Subject: [PATCH] Show error name instead of error if shutdown/reboot fails Signed-off-by: AnErrupTion --- src/main.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.zig b/src/main.zig index 710d67b..6fc758c 100644 --- a/src/main.zig +++ b/src/main.zig @@ -66,10 +66,10 @@ pub fn main() !void { // If we can't shutdown or restart due to an error, we print it to standard error. If that fails, just bail out if (shutdown) { const shutdown_error = std.process.execv(temporary_allocator, &[_][]const u8{ "/bin/sh", "-c", shutdown_cmd }); - stderr.print("error: couldn't shutdown: {any}\n", .{shutdown_error}) catch std.process.exit(1); + stderr.print("error: couldn't shutdown: {s}\n", .{@errorName(shutdown_error)}) catch std.process.exit(1); } else if (restart) { const restart_error = std.process.execv(temporary_allocator, &[_][]const u8{ "/bin/sh", "-c", restart_cmd }); - stderr.print("error: couldn't restart: {any}\n", .{restart_error}) catch std.process.exit(1); + stderr.print("error: couldn't restart: {s}\n", .{@errorName(restart_error)}) catch std.process.exit(1); } else { // The user has quit Ly using Ctrl+C temporary_allocator.free(shutdown_cmd);