fix(ui): implement cached startup pre-flight check in SessionService and propagate errors in StaleBanner

This commit is contained in:
2026-07-16 21:18:14 +09:00
parent 2eb85866b3
commit 7c981549a2
3 changed files with 28 additions and 5 deletions
@@ -27,7 +27,27 @@ class SessionService {
this.timeout = const Duration(seconds: 5),
});
bool _preflightChecked = false;
Future<void> _checkPreflight() async {
if (_preflightChecked) return;
final bashResult = await runCommand(['bash', '--version'], timeout: timeout);
if (bashResult.rc != 0) {
throw StatusFetchException('preflight failed: bash is missing or not executable');
}
final tmuxResult = await runCommand(['tmux', '-V'], timeout: timeout);
if (tmuxResult.rc != 0) {
throw StatusFetchException('preflight failed: tmux is missing or not executable');
}
_preflightChecked = true;
}
Future<SessionsSnapshot> fetchSnapshot() async {
await _checkPreflight();
final result = await runCommand(
['bash', statusScriptPath, '--json'],
timeout: timeout,