plugin_logs: call /usr/bin/log by absolute path on macOS
`log` is a zsh shell builtin on macOS, so a bare `log show ...` executed through a user's shell answers "too many arguments" and exits 0 with no output - an empty unified-log view that looks like an idle machine.
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-12 06:58:50
Commitc6c99184
Parentsbe6ee150
Changed files
src/plugin_logs.c+8−1■■■■■
1 file+8−1
Diff
src/plugin_logs.c+8−1■■■■■
index 659a399..74baf48 100644
--- a/src/plugin_logs.c
+++ b/src/plugin_logs.c
@@ -1005,8 +1005,15 @@ static int stream_macos_log(int nlines, const char *filter,
10051005 if (mins < 1) mins = 1;
10061006 if (mins > 60) mins = 60;
10071007
1008+ /*
1009+ * Absolute path, and it matters: on macOS `log` is also a zsh shell
1010+ * builtin, so a bare `log show` run through a user's shell prints
1011+ * "zsh:log: too many arguments" and exits 0 with no output. popen uses
1012+ * /bin/sh so it is only latent there, but the fixed path removes the
1013+ * class of failure entirely.
1014+ */
10081015 snprintf(cmd, sizeof(cmd),
1009- "log show --style compact --last %dm 2>/dev/null | tail -n %d",
1016+ "/usr/bin/log show --style compact --last %dm 2>/dev/null | tail -n %d",
10101017 mins, nlines);
10111018 f = run_cmd(cmd);
10121019 if (!f) return -1;
10131020
src/plugin_logs.c+8−1■■■■■
index 659a399..74baf48 100644index 659a399..74baf48 100644
--- a/src/plugin_logs.c--- a/src/plugin_logs.c
+++ b/src/plugin_logs.c+++ b/src/plugin_logs.c
@@ -1005,8 +1005,15 @@ static int stream_macos_log(int nlines, const char *filter,@@ -1005,8 +1005,15 @@ static int stream_macos_log(int nlines, const char *filter,
1005 if (mins < 1) mins = 1;1005 if (mins < 1) mins = 1;
1006 if (mins > 60) mins = 60;1006 if (mins > 60) mins = 60;
1007 1007
1008+ /*
1009+ * Absolute path, and it matters: on macOS `log` is also a zsh shell
1010+ * builtin, so a bare `log show` run through a user's shell prints
1011+ * "zsh:log: too many arguments" and exits 0 with no output. popen uses
1012+ * /bin/sh so it is only latent there, but the fixed path removes the
1013+ * class of failure entirely.
1014+ */
1008 snprintf(cmd, sizeof(cmd),1015 snprintf(cmd, sizeof(cmd),
1009- "log show --style compact --last %dm 2>/dev/null | tail -n %d",1016+ "/usr/bin/log show --style compact --last %dm 2>/dev/null | tail -n %d",
1010 mins, nlines);1017 mins, nlines);
1011 f = run_cmd(cmd);1018 f = run_cmd(cmd);
1012 if (!f) return -1;1019 if (!f) return -1;
10131020