MCPcopy Index your code
hub / github.com/callstack/agent-device / readRecentLogTail

Function readRecentLogTail

src/daemon/client/daemon-client-lifecycle.ts:451–469  ·  view source on GitHub ↗
(logPath: string)

Source from the content-addressed store, hash-verified

449}
450
451function readRecentLogTail(logPath: string): string | undefined {
452 try {
453 if (!fs.existsSync(logPath)) return undefined;
454 const stats = fs.statSync(logPath);
455 if (stats.size <= 0) return undefined;
456 const length = Math.min(stats.size, DAEMON_STARTUP_LOG_TAIL_BYTES);
457 const fd = fs.openSync(logPath, 'r');
458 try {
459 const buffer = Buffer.alloc(length);
460 fs.readSync(fd, buffer, 0, length, stats.size - length);
461 const text = buffer.toString('utf8').trim();
462 return text.length > 0 ? text : undefined;
463 } finally {
464 fs.closeSync(fd);
465 }
466 } catch {
467 return undefined;
468 }
469}
470
471function resolveRemoteDaemonBaseUrl(raw: string | undefined): string | undefined {
472 if (!raw) return undefined;

Callers 1

startLocalDaemonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected