diff options
| author | akbash <akbash@herdr.dev> | 2026-07-20 02:13:40 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-20 02:13:40 +0300 |
| commit | 9450b168c727e9e4cbee95e6edf4f11cfe6f2154 (patch) | |
| tree | 1001b99be3139aa74740a71392d45f8c6c229aca /src | |
| parent | d30ab1b54f6b6be95a0cb47ddc38da1d5e088700 (diff) | |
fix: avoid rechecking cached pane cwd (#1616)
refs #1603
Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/pane.rs | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/pane.rs b/src/pane.rs index 59dee7ef..ad9e1f92 100644 --- a/src/pane.rs +++ b/src/pane.rs @@ -2693,7 +2693,6 @@ impl PaneRuntime { .lock() .ok() .and_then(|reported_cwd| reported_cwd.clone()) - .and_then(usable_reported_cwd) { return Some(cwd); } @@ -2826,6 +2825,32 @@ impl PaneRuntime { mod tests { use super::*; + #[tokio::test] + async fn cwd_returns_accepted_report_without_rechecking_filesystem() { + let stamp = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .expect("clock should be after unix epoch") + .as_nanos(); + let cwd = std::env::temp_dir().join(format!( + "herdr-reported-cwd-cache-{}-{stamp}", + std::process::id() + )); + std::fs::create_dir(&cwd).expect("create reported cwd"); + + let (runtime, _rx) = PaneRuntime::test_with_channel(80, 24); + let (events, _event_rx) = mpsc::channel(1); + publish_reported_cwd(runtime.pane_id, cwd.clone(), &runtime.reported_cwd, &events); + assert_eq!( + runtime.reported_cwd.lock().unwrap().as_ref(), + Some(&cwd), + "test setup must pass cache admission" + ); + + std::fs::remove_dir(&cwd).expect("remove reported cwd after admission"); + + assert_eq!(runtime.cwd(), Some(cwd)); + } + #[cfg(unix)] #[tokio::test] async fn follow_cwd_falls_back_to_reported_pane_cwd_without_foreground_group() { |
