aboutsummaryrefslogtreecommitdiff
path: root/tests/api_ping.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-03-31 23:03:11 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-03-31 23:03:11 +0300
commite857710d73ad660d17ce39fa3201a39aa49f6932 (patch)
tree7fa2db20fc6c4e78b9d182af449784ed48515c9e /tests/api_ping.rs
parent5f97b0c26d848ef36aed70df906893907e2d0686 (diff)
fix: align pane scrolling with tmux and ghostty
Diffstat (limited to 'tests/api_ping.rs')
-rw-r--r--tests/api_ping.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/api_ping.rs b/tests/api_ping.rs
index 043d9931..42e5ac0f 100644
--- a/tests/api_ping.rs
+++ b/tests/api_ping.rs
@@ -1,5 +1,5 @@
use std::fs;
-use std::io::{BufRead, BufReader, Write};
+use std::io::{BufRead, BufReader, Read, Write};
use std::os::unix::net::UnixStream;
use std::path::{Path, PathBuf};
use std::sync::{Mutex, MutexGuard, OnceLock};
@@ -18,6 +18,7 @@ fn unique_test_dir() -> PathBuf {
struct SpawnedHerdr {
_master: Box<dyn MasterPty + Send>,
+ _drain_thread: thread::JoinHandle<()>,
child: Box<dyn Child + Send + Sync>,
}
@@ -76,10 +77,22 @@ fn spawn_herdr_with_path(
cmd.env("PATH", path);
}
+ let mut reader = pair.master.try_clone_reader().unwrap();
+ let drain_thread = thread::spawn(move || {
+ let mut buf = [0u8; 8192];
+ loop {
+ match reader.read(&mut buf) {
+ Ok(0) | Err(_) => break,
+ Ok(_) => {}
+ }
+ }
+ });
+
let child = pair.slave.spawn_command(cmd).unwrap();
SpawnedHerdr {
_master: pair.master,
+ _drain_thread: drain_thread,
child,
}
}