mirror of
https://github.com/fairyglade/ly.git
synced 2026-05-06 07:10:36 +00:00
Prefer std.log instead of stderr directly
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
12
src/main.zig
12
src/main.zig
@@ -146,12 +146,10 @@ pub fn main(init: std.process.Init) !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 we can't shutdown or restart due to an error, we print it to standard error. If that fails, just bail out
|
||||||
if (shutdown) {
|
if (shutdown) {
|
||||||
const shutdown_error = std.process.replace(state.io, .{ .argv = &[_][]const u8{ "/bin/sh", "-c", shutdown_cmd } });
|
const shutdown_error = std.process.replace(state.io, .{ .argv = &[_][]const u8{ "/bin/sh", "-c", shutdown_cmd } });
|
||||||
stderr.print("error: couldn't shutdown: {s}\n", .{@errorName(shutdown_error)}) catch std.process.exit(1);
|
std.log.err("couldn't shutdown: {s}", .{@errorName(shutdown_error)});
|
||||||
stderr.flush() catch std.process.exit(1);
|
|
||||||
} else if (restart) {
|
} else if (restart) {
|
||||||
const restart_error = std.process.replace(state.io, .{ .argv = &[_][]const u8{ "/bin/sh", "-c", restart_cmd } });
|
const restart_error = std.process.replace(state.io, .{ .argv = &[_][]const u8{ "/bin/sh", "-c", restart_cmd } });
|
||||||
stderr.print("error: couldn't restart: {s}\n", .{@errorName(restart_error)}) catch std.process.exit(1);
|
std.log.err("couldn't restart: {s}", .{@errorName(restart_error)});
|
||||||
stderr.flush() catch std.process.exit(1);
|
|
||||||
} else {
|
} else {
|
||||||
// The user has quit Ly using Ctrl+C
|
// The user has quit Ly using Ctrl+C
|
||||||
if (commands_allocated) {
|
if (commands_allocated) {
|
||||||
@@ -201,13 +199,11 @@ pub fn main(init: std.process.Init) !void {
|
|||||||
if (res.args.help != 0) {
|
if (res.args.help != 0) {
|
||||||
try clap.help(stderr, clap.Help, ¶ms, .{});
|
try clap.help(stderr, clap.Help, ¶ms, .{});
|
||||||
|
|
||||||
_ = try stderr.write("Note: if you want to configure Ly, please check the config file, which is located at " ++ build_options.config_directory ++ "/ly/config.ini.\n");
|
std.log.info("note: if you want to configure Ly, please check the config file, which is located at " ++ build_options.config_directory ++ "/ly/config.ini.", .{});
|
||||||
try stderr.flush();
|
|
||||||
std.process.exit(0);
|
std.process.exit(0);
|
||||||
}
|
}
|
||||||
if (res.args.version != 0) {
|
if (res.args.version != 0) {
|
||||||
_ = try stderr.write("Ly version " ++ build_options.version ++ "\n");
|
std.log.info("ly version " ++ build_options.version, .{});
|
||||||
try stderr.flush();
|
|
||||||
std.process.exit(0);
|
std.process.exit(0);
|
||||||
}
|
}
|
||||||
if (res.args.config) |path| config_parent_path = path;
|
if (res.args.config) |path| config_parent_path = path;
|
||||||
|
|||||||
Reference in New Issue
Block a user