buildAppDiedException function
Builds an AppDiedException by reading the log tail and, when possible, performing a best-effort OS-level reason lookup.
pid is used on some platforms; may be null if the PID file was absent.
This is a shared helper reused by #58 (fdb crash-report).
Implementation
Future<AppDiedException> buildAppDiedException({int? pid}) async {
final logLines = readLastLogLines();
final reason = await _lookupCrashReason(pid: pid);
return AppDiedException(logLines: logLines, reason: reason);
}