mirror of
https://github.com/Routstr/routstrd.git
synced 2026-10-06 04:38:23 +00:00
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:
+5
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user