feat(host): the app's books server is a child process; the bridge says in words when the app isn't running or a company isn't open
The desktop app is the host (D-77, D-84): AppServer starts the books server from the program's own executable, closes it by closing its input, and never signals it. A window that dies closes the same pipe, so the books close cleanly. A start is refused in words when host.lock or server.lock is held. Starting writes run/app-hosted; for such a root with no host the bridge holds no lease and starts no host, and answers 'Wanderbooks isn't running' or 'Company X isn't open' (WB-app-1, WB-app-3). Owner commands and the viewer take a lease-less hold on the app's server instead of starting a host beside it; closing the books and wanderbooks serve say the app has them. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
7058fbd2b9
commit
c8c0f5e0d9
7 files changed
+816
-11
No files matched your search
@@ -1129,12 +1129,20 @@ pub fn new_books(common: &Common, id: &str, currency: &str) -> Result<String, St
|
||||
}
|
||||
}
|
||||
|
||||
/// What closing the books says while the app has them open: the app's
|
||||
/// tabs and its window close them.
|
||||
const APP_HAS_THEM: &str = "Wanderbooks (the app) has these books open: close a company's tab to close that company, or close the window to close them all";
|
||||
|
||||
/// "Close the books": everything holding them lets go (the lease
|
||||
/// socket's close intent). What came of it.
|
||||
pub fn close_books(common: &Common) -> Result<String, String> {
|
||||
let found =
|
||||
ledger_store::root::Root::find(common.root.as_deref()).map_err(|e| e.to_string())?;
|
||||
let run = found.run_dir().map_err(|e| e.to_string())?;
|
||||
// The app's own server: no host to ask (it isn't "closed": it is open).
|
||||
if crate::app_server::the_apps_server_runs(&run) {
|
||||
return Err(APP_HAS_THEM.into());
|
||||
}
|
||||
match crate::opener::ask_once_within(&run, Ask::Intent(Intent::Close), HOST_WAIT)? {
|
||||
None => Ok("The books are closed.".into()),
|
||||
Some(HostMsg::Done { detail }) => Ok(detail
|
||||
|
||||
Reference in new issue
Block a user