diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-10-05 00:28:40 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-10-05 00:28:40 +0200 |
| commit | cd7a7667ce983234b4411ae99835763d118566df (patch) | |
| tree | 5037a22e897d89fc52a284c1eeef2b096755a16b | |
| parent | unflake.nix: Update devshells (diff) | |
| download | nixos-config-cd7a7667ce983234b4411ae99835763d118566df.zip | |
pkgs/fish-patched: Warn instead of crash when no turtle daemon is present
| -rw-r--r-- | pkgs/by-name/fi/fish-patched/patches/0009-hisory-turle-don-t-crash-when-failing-to-connect-to-.patch | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/pkgs/by-name/fi/fish-patched/patches/0009-hisory-turle-don-t-crash-when-failing-to-connect-to-.patch b/pkgs/by-name/fi/fish-patched/patches/0009-hisory-turle-don-t-crash-when-failing-to-connect-to-.patch new file mode 100644 index 00000000..cbb61bc6 --- /dev/null +++ b/pkgs/by-name/fi/fish-patched/patches/0009-hisory-turle-don-t-crash-when-failing-to-connect-to-.patch @@ -0,0 +1,66 @@ +From 01ad908aaa05f5f5b73139bb026dce81d0058457 Mon Sep 17 00:00:00 2001 +From: Benedikt Peetz <benedikt.peetz@b-peetz.de> +Date: Mon, 5 Oct 2026 00:26:13 +0200 +Subject: [PATCH] hisory/turle: don't crash when failing to connect to turtle + daemon + +Otherwise, a system with this fish as default shell becomes completely +unresponsive. +--- + src/history/turtle.rs | 38 +++++++++++++++++++++++++------------- + 1 file changed, 25 insertions(+), 13 deletions(-) + +diff --git a/src/history/turtle.rs b/src/history/turtle.rs +index 196681058..8c9770030 100644 +--- a/src/history/turtle.rs ++++ b/src/history/turtle.rs +@@ -278,21 +278,33 @@ fn start(daemon_socket: String) -> Self { + b.build() + .expect("to work, as all the fish code is otherwise sync.") + }; +- let mut client = match rt.block_on(turtle_api::client::probe(daemon_socket.clone())) { +- Probe::Ready(_) => rt +- .block_on(HistoryClient::new(daemon_socket)) +- .expect("We probed, this client should be accessible"), +- Probe::NeedsRestart(err) => { +- flogf!(history, "Turtle daemon needs restart: %s", err); +- todo!(); +- } +- Probe::Unreachable(report) => { +- flogf!(history, "Turtle daemon unreachable: %s", report.to_string()); +- todo!(); +- } +- }; ++ let mut maybe_client = ++ match rt.block_on(turtle_api::client::probe(daemon_socket.clone())) { ++ Probe::Ready(_) => Some( ++ rt.block_on(HistoryClient::new(daemon_socket)) ++ .expect("We probed, this client should be accessible"), ++ ), ++ Probe::NeedsRestart(err) => { ++ flogf!(error, "Turtle daemon needs restart: %s", err); ++ None ++ } ++ Probe::Unreachable(report) => { ++ flogf!(error, "Turtle daemon unreachable: %s", report.to_string()); ++ None ++ } ++ }; + + while let Ok(cmd) = cmd_rx.recv() { ++ let Some(client) = maybe_client.as_mut() else { ++ if matches!(cmd, HandleHistoryCmd::Start { .. }) { ++ flog!( ++ error, ++ "*** Not connected to turtle daemon, no history will be saved ***" ++ ); ++ } ++ continue; ++ }; ++ + match cmd { + HandleHistoryCmd::Start { history } => { + let command = history.command.clone(); +-- +2.55.0 + |
