From fa495b338bf75428999657ef2cda5f6d5ecd7acc Mon Sep 17 00:00:00 2001 From: redshift <213178690+1ftredsh@users.noreply.github.com> Date: Wed, 29 Jul 2026 13:32:02 +0100 Subject: [PATCH] fix(cli): guard followLogFile against missing today file, remove duplicate error - Guard followLogFile call with existsSync check so it doesn't crash with ENOENT when today's log doesn't exist (but yesterday's does) - Remove redundant console.error(installHint), keep only logger.error Review fixes for PR #44 --- src/cli.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 53e335e..2642d4a 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -429,7 +429,6 @@ program const installHint = config.cocodPath ? `Configured cocod executable was not found: ${config.cocodPath}` : "cocod is not installed. Run 'routstrd onboard' first to install cocod."; - console.error(installHint); logger.error(installHint); process.exit(1); } @@ -1710,7 +1709,11 @@ program }); if (options.follow) { - await followLogFile(todayFile, lines); + if (existsSync(todayFile)) { + await followLogFile(todayFile, lines); + } else { + console.log("No log file for today to follow."); + } return; }