feat(wezterm): capture both stdout & stderr in system log

This commit is contained in:
Price Hiller 2023-09-05 12:37:48 -05:00
parent ccfbc6b226
commit be90f4ebf0
Signed by: Price
SSH Key Fingerprint: SHA256:Y4S9ZzYphRn1W1kbJerJFO6GGsfu9O70VaBSxJO7dF8

View File

@ -20,7 +20,7 @@ local function system_log(message, opts)
local log_unit = "wezterm"
if os_detected == "linux" then
local handle =
io.popen(string.format("systemd-cat -t %s -p %s echo '%s'", log_unit, opts.level:lower(), message))
io.popen(string.format("systemd-cat -t %s -p %s echo '%s' 2>&1", log_unit, opts.level:lower(), message))
if not opts.ignore_result or opts.ignore_result == nil then
---@diagnostic disable-next-line: need-check-nil
local output = handle:read("*a")
@ -33,7 +33,7 @@ local function system_log(message, opts)
local success = handle:close()
if success == nil or not success then
wezterm.log_warn(
string.format("'systemd-cat' did not indicate a successful run!\nHandle Output:\n%s", output)
string.format("'systemd-cat' did not indicate a successful run!\nHandle Output: %s", output)
)
end
end