diff --git a/crates/maestro-daemon/tests/session_manager.rs b/crates/maestro-daemon/tests/session_manager.rs index c73c5cc..28f827b 100644 --- a/crates/maestro-daemon/tests/session_manager.rs +++ b/crates/maestro-daemon/tests/session_manager.rs @@ -130,19 +130,28 @@ async fn recover_re_pipes_pane_so_output_reaches_subscribers() { .await .expect("create"); - // Drop the original manager. The previous daemon's `pipe-pane` is still - // running against tmux, pointing at a FIFO no one reads now. + // Capture paths + tmux handle before dropping the original manager — + // `drop(fx.manager)` partially moves `fx` so we can't call its helpers + // afterwards. + let sidecar_dir = fx.sidecar_dir(); + let fifo_dir = fx.fifo_dir(); + let tmux = fx.tmux.tmux.clone(); + let worktree_root = fx.worktree_root.path().to_path_buf(); + + // Drop the original manager. Its PtyBridge closes the FIFO's only + // reader, so tmux's `cat >> fifo` writer hits SIGPIPE and exits — but + // tmux's pipe-pane bookkeeping still thinks the pane is piped. That's + // exactly the stale state recover() has to overwrite. drop(fx.manager); - let sidecar = maestro_daemon::sidecar::SidecarStore::new(fx.sidecar_dir()); - let worktree_mgr = - maestro_daemon::worktree::WorktreeManager::new(fx.worktree_root.path().to_path_buf()); + let sidecar = maestro_daemon::sidecar::SidecarStore::new(sidecar_dir); + let worktree_mgr = maestro_daemon::worktree::WorktreeManager::new(worktree_root); let revived = maestro_daemon::SessionManager::new( "laptop".to_string(), - fx.tmux.tmux.clone(), + tmux, sidecar, worktree_mgr, - fx.fifo_dir(), + fifo_dir, ); assert_eq!(revived.recover().await.expect("recover"), 1);