plugin_logs: dispatch the journal source per platform, not per kind
collect_tail/collect_search checked kind==journal against journalctl before the __APPLE__ branch, so a macOS build answered tail&src=journal from journalctl (absent on a Mac) and returned an empty list while the UI said 'a live source, 0 entries'.
AuthorPico <picobot@scorpioplayer.com>
Date2026-11-12 07:00:32
Commit0ed5b7e1
Parentsd98b4cd3
Changed files
src/plugin_logs.c+14−7■■■■■
1 file+14−7
Diff
src/plugin_logs.c+14−7■■■■■
index 74baf48..d8ad7d8 100644
--- a/src/plugin_logs.c
+++ b/src/plugin_logs.c
@@ -1164,15 +1164,17 @@ static int collect_tail(const src_t *s, int nlines, ring_t *ring)
11641164 shell_ctx_t ctx;
11651165
11661166 ctx.ring = ring;
1167+ /* Platform first: on macOS the "journal" kind is `log show`, not
1168+ * journalctl, and the generic branch below would swallow it. */
1169+#if defined(__APPLE__)
11671170 if (strcmp(s->kind, "journal") == 0)
1168- return stream_journal(NULL, nlines, NULL, shell_sink, &ctx);
1169-#if defined(_WIN32)
1171+ return stream_macos_log(nlines, NULL, shell_sink, &ctx);
1172+#elif defined(_WIN32)
11701173 if (strncmp(s->id, "event:", 6) == 0)
11711174 return stream_event_log(s->id + 6, nlines, NULL, shell_sink, &ctx);
1172-#endif
1173-#if defined(__APPLE__)
1175+#else
11741176 if (strcmp(s->kind, "journal") == 0)
1175- return stream_macos_log(nlines, NULL, shell_sink, &ctx);
1177+ return stream_journal(NULL, nlines, NULL, shell_sink, &ctx);
11761178 #endif
11771179 if (strncmp(s->id, "file:", 5) == 0)
11781180 return read_log_file(s->id + 5, nlines, NULL, ring, NULL, 0);
@@ -1197,11 +1199,16 @@ static int collect_search(const src_t *s, const char *filter, list_t *hits)
11971199 hits_ctx_t ctx;
11981200
11991201 ctx.hits = hits;
1202+ /* same platform-first order as collect_tail */
1203+#if defined(__APPLE__)
12001204 if (strcmp(s->kind, "journal") == 0)
1201- return stream_journal(NULL, TAIL_MAX, filter, hits_sink, &ctx);
1202-#if defined(_WIN32)
1205+ return stream_macos_log(TAIL_MAX, filter, hits_sink, &ctx);
1206+#elif defined(_WIN32)
12031207 if (strncmp(s->id, "event:", 6) == 0)
12041208 return stream_event_log(s->id + 6, 600, filter, hits_sink, &ctx);
1209+#else
1210+ if (strcmp(s->kind, "journal") == 0)
1211+ return stream_journal(NULL, TAIL_MAX, filter, hits_sink, &ctx);
12051212 #endif
12061213 if (strncmp(s->id, "file:", 5) == 0)
12071214 return read_log_file(s->id + 5, TAIL_MAX, filter, NULL, hits, SEARCH_HITS_MAX);
12081215
src/plugin_logs.c+14−7■■■■■
index 74baf48..d8ad7d8 100644index 74baf48..d8ad7d8 100644
--- a/src/plugin_logs.c--- a/src/plugin_logs.c
+++ b/src/plugin_logs.c+++ b/src/plugin_logs.c
@@ -1164,15 +1164,17 @@ static int collect_tail(const src_t *s, int nlines, ring_t *ring)@@ -1164,15 +1164,17 @@ static int collect_tail(const src_t *s, int nlines, ring_t *ring)
1164 shell_ctx_t ctx;1164 shell_ctx_t ctx;
1165 1165
1166 ctx.ring = ring;1166 ctx.ring = ring;
1167+ /* Platform first: on macOS the "journal" kind is `log show`, not
1168+ * journalctl, and the generic branch below would swallow it. */
1169+#if defined(__APPLE__)
1167 if (strcmp(s->kind, "journal") == 0)1170 if (strcmp(s->kind, "journal") == 0)
1168- return stream_journal(NULL, nlines, NULL, shell_sink, &ctx);1171+ return stream_macos_log(nlines, NULL, shell_sink, &ctx);
1169-#if defined(_WIN32)1172+#elif defined(_WIN32)
1170 if (strncmp(s->id, "event:", 6) == 0)1173 if (strncmp(s->id, "event:", 6) == 0)
1171 return stream_event_log(s->id + 6, nlines, NULL, shell_sink, &ctx);1174 return stream_event_log(s->id + 6, nlines, NULL, shell_sink, &ctx);
1172-#endif1175+#else
1173-#if defined(__APPLE__)
1174 if (strcmp(s->kind, "journal") == 0)1176 if (strcmp(s->kind, "journal") == 0)
1175- return stream_macos_log(nlines, NULL, shell_sink, &ctx);1177+ return stream_journal(NULL, nlines, NULL, shell_sink, &ctx);
1176 #endif1178 #endif
1177 if (strncmp(s->id, "file:", 5) == 0)1179 if (strncmp(s->id, "file:", 5) == 0)
1178 return read_log_file(s->id + 5, nlines, NULL, ring, NULL, 0);1180 return read_log_file(s->id + 5, nlines, NULL, ring, NULL, 0);
@@ -1197,11 +1199,16 @@ static int collect_search(const src_t *s, const char *filter, list_t *hits)@@ -1197,11 +1199,16 @@ static int collect_search(const src_t *s, const char *filter, list_t *hits)
1197 hits_ctx_t ctx;1199 hits_ctx_t ctx;
1198 1200
1199 ctx.hits = hits;1201 ctx.hits = hits;
1202+ /* same platform-first order as collect_tail */
1203+#if defined(__APPLE__)
1200 if (strcmp(s->kind, "journal") == 0)1204 if (strcmp(s->kind, "journal") == 0)
1201- return stream_journal(NULL, TAIL_MAX, filter, hits_sink, &ctx);1205+ return stream_macos_log(TAIL_MAX, filter, hits_sink, &ctx);
1202-#if defined(_WIN32)1206+#elif defined(_WIN32)
1203 if (strncmp(s->id, "event:", 6) == 0)1207 if (strncmp(s->id, "event:", 6) == 0)
1204 return stream_event_log(s->id + 6, 600, filter, hits_sink, &ctx);1208 return stream_event_log(s->id + 6, 600, filter, hits_sink, &ctx);
1209+#else
1210+ if (strcmp(s->kind, "journal") == 0)
1211+ return stream_journal(NULL, TAIL_MAX, filter, hits_sink, &ctx);
1205 #endif1212 #endif
1206 if (strncmp(s->id, "file:", 5) == 0)1213 if (strncmp(s->id, "file:", 5) == 0)
1207 return read_log_file(s->id + 5, TAIL_MAX, filter, NULL, hits, SEARCH_HITS_MAX);1214 return read_log_file(s->id + 5, TAIL_MAX, filter, NULL, hits, SEARCH_HITS_MAX);
12081215