mirror of https://github.com/fairyglade/ly.git
Show error name instead of error if shutdown/reboot fails
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
parent
5bacc8870b
commit
cd0accfb28
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue