mirror of
https://github.com/Dasemu/Grove.git
synced 2026-11-26 15:26:09 +00:00
fix(daemon): never block the sync loop on a prompt or a stuck git call
The daemon inherited the desktop session's SSH_ASKPASS (ksshaskpass), so an ssh passphrase/host-key prompt opened a dialog nobody answered, and git had no time limit: the single sync loop stalled for 1.5 h and repos migrated meanwhile were never picked up. - groved sets a non-interactive git env (no terminal/askpass prompts, HTTP low-speed abort) and leaves the ssh command to the user/repo. - Git calls get an optional wall-clock limit (daemon: 900 s); on expiry the whole process group (git, ssh, helpers) is killed. - Secret Service lookups time out like the forge CLIs (locked keyring). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5f33bb9327
commit
4c355b28ef
4 files changed
+154
-15
No files matched your search
@@ -31,10 +31,19 @@ pub fn get(provider_id: &str) -> Result<String> {
|
||||
return Ok(t.trim().to_string());
|
||||
}
|
||||
let e = keyring::Entry::new(SERVICE, provider_id).map_err(|e| Error::Other(e.to_string()))?;
|
||||
match e.get_password() {
|
||||
Ok(t) => Ok(t),
|
||||
Err(keyring::Error::NoEntry) => Err(Error::NoToken(provider_id.into())),
|
||||
Err(e) => Err(Error::Other(format!("secret service: {e}"))),
|
||||
// A locked keyring may wait on an unlock dialog: never block the caller for longer than the
|
||||
// forge CLIs get (the thread is left behind if the Secret Service never answers).
|
||||
let (tx, rx) = std::sync::mpsc::channel();
|
||||
std::thread::spawn(move || {
|
||||
let _ = tx.send(e.get_password());
|
||||
});
|
||||
match rx.recv_timeout(CLI_TIMEOUT) {
|
||||
Ok(Ok(t)) => Ok(t),
|
||||
Ok(Err(keyring::Error::NoEntry)) => Err(Error::NoToken(provider_id.into())),
|
||||
Ok(Err(e)) => Err(Error::Other(format!("secret service: {e}"))),
|
||||
Err(_) => Err(Error::Other(
|
||||
"secret service did not answer in time (locked keyring?)".into(),
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user