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
This commit is contained in:
redshift
2026-07-29 13:32:02 +01:00
parent ae8bfb9d77
commit fa495b338b
+5 -2
View File
@@ -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;
}