From 932c751ac2c709b50472234cff38cb8d620ef926 Mon Sep 17 00:00:00 2001 From: AnErrupTion Date: Thu, 6 Mar 2025 21:46:40 +0100 Subject: [PATCH] Stop redirecting X11 output to session log (closes #693, #688) Signed-off-by: AnErrupTion --- res/config.ini | 5 +++-- src/auth.zig | 7 ++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/res/config.ini b/res/config.ini index 6dd7af3..413110d 100644 --- a/res/config.ini +++ b/res/config.ini @@ -183,9 +183,10 @@ save = true service_name = ly # Session log file path -# This will contain stdout and stderr of X11 and Wayland sessions +# This will contain stdout and stderr of Wayland sessions # By default it's saved in the user's home directory -# Note: this file won't be used in a shell session (due to the need of stdout and stderr) +# Important: due to technical limitations, X11 and shell sessions aren't supported, which +# means you won't get any logs from those sessions session_log = ly-session.log # Setup command diff --git a/src/auth.zig b/src/auth.zig index 216784d..e3d8e32 100644 --- a/src/auth.zig +++ b/src/auth.zig @@ -375,9 +375,6 @@ fn xauth(display_name: [:0]u8, shell: [*:0]const u8, pw_dir: [*:0]const u8, opti const pid = try std.posix.fork(); if (pid == 0) { - const log_file = try redirectStandardStreams(options.session_log, true); - defer log_file.close(); - var cmd_buffer: [1024]u8 = undefined; const cmd_str = std.fmt.bufPrintZ(&cmd_buffer, "{s} add {s} . {s}", .{ options.xauth_cmd, display_name, magic_cookie }) catch std.process.exit(1); const args = [_:null]?[*:0]const u8{ shell, "-c", cmd_str }; @@ -417,7 +414,7 @@ fn executeX11Cmd(shell: [*:0]const u8, pw_dir: [*:0]const u8, options: AuthOptio const pid = try std.posix.fork(); if (pid == 0) { var cmd_buffer: [1024]u8 = undefined; - const cmd_str = std.fmt.bufPrintZ(&cmd_buffer, "{s} {s} {s} >{s} 2>&1", .{ options.x_cmd, display_name, vt, options.session_log }) catch std.process.exit(1); + const cmd_str = std.fmt.bufPrintZ(&cmd_buffer, "{s} {s} {s}", .{ options.x_cmd, display_name, vt }) catch std.process.exit(1); const args = [_:null]?[*:0]const u8{ shell, "-c", cmd_str }; std.posix.execveZ(shell, &args, std.c.environ) catch {}; std.process.exit(1); @@ -440,7 +437,7 @@ fn executeX11Cmd(shell: [*:0]const u8, pw_dir: [*:0]const u8, options: AuthOptio xorg_pid = try std.posix.fork(); if (xorg_pid == 0) { var cmd_buffer: [1024]u8 = undefined; - const cmd_str = std.fmt.bufPrintZ(&cmd_buffer, "{s} {s} {s} >{s} 2>&1", .{ options.setup_cmd, options.login_cmd orelse "", desktop_cmd, options.session_log }) catch std.process.exit(1); + const cmd_str = std.fmt.bufPrintZ(&cmd_buffer, "{s} {s} {s}", .{ options.setup_cmd, options.login_cmd orelse "", desktop_cmd }) catch std.process.exit(1); const args = [_:null]?[*:0]const u8{ shell, "-c", cmd_str }; std.posix.execveZ(shell, &args, std.c.environ) catch {}; std.process.exit(1);