diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-08-23 22:23:10 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-08-23 22:23:10 +0200 |
| commit | f9b360c8dbf7658c5ed6632e43fab9ded1fa9b28 (patch) | |
| tree | 6fb457530ead08f56b621ff7ca62c358159160bb /crates/daemon/src | |
| parent | nix/module.hm.nix: Init home-manager module (diff) | |
| download | atuin-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/daemon/src')
| -rw-r--r-- | crates/daemon/src/aclient/history/mod.rs | 9 |
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)?; |
