aboutsummaryrefslogtreecommitdiffstats
path: root/crates
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-08-23 22:23:10 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-08-23 22:23:10 +0200
commitf9b360c8dbf7658c5ed6632e43fab9ded1fa9b28 (patch)
tree6fb457530ead08f56b621ff7ca62c358159160bb /crates
parentnix/module.hm.nix: Init home-manager module (diff)
downloadatuin-f9b360c8dbf7658c5ed6632e43fab9ded1fa9b28.zip
crates/daemon/aclient/history: Don't panic on negative command duration
The old atuin code, used a negative duration as no-duration sentinel.
Diffstat (limited to 'crates')
-rw-r--r--crates/daemon/src/aclient/history/mod.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/daemon/src/aclient/history/mod.rs b/crates/daemon/src/aclient/history/mod.rs
index 35abc89d..0b5f4982 100644
--- a/crates/daemon/src/aclient/history/mod.rs
+++ b/crates/daemon/src/aclient/history/mod.rs
@@ -181,7 +181,14 @@ impl HistoryExt for History {
let mut bytes = Bytes::new(bytes);
let timestamp = decode::read_u64(&mut bytes).map_err(error_report)?;
let duration = decode::read_int(&mut bytes)
- .map(|int: i64| Duration::from_nanos(u64::try_from(int).expect("to be small enough")))
+ .map(|int: i64| {
+ if int.is_negative() {
+ // TODO: We should probably handle this case differently <2026-08-23>
+ Duration::from_nanos(0)
+ } else {
+ Duration::from_nanos(u64::try_from(int).expect("to be small enough"))
+ }
+ })
.map_err(error_report)?;
let exit = decode::read_int(&mut bytes).map_err(error_report)?;