mirror of
https://github.com/lotabout/skim.git
synced 2026-09-10 07:16:23 -04:00
27 lines
904 B
Rust
27 lines
904 B
Rust
//! Runs skim repeatedly to check that runs clean up their worker threads.
|
|
|
|
use skim::Skim;
|
|
use skim::prelude::SkimOptionsBuilder;
|
|
|
|
// Hint: use `ps -T -p $(pgrep -f target/debug/examples/multiple_runs)` to watch threads while the
|
|
// different invocations run, and make sure none is leaking through
|
|
fn main() {
|
|
for i in 0..3 {
|
|
let opts = SkimOptionsBuilder::default()
|
|
.header(format!("run {i}"))
|
|
.cmd("cat benches/fixtures/10M.txt")
|
|
.build()
|
|
.unwrap();
|
|
let res = Skim::run_with(opts, None).unwrap();
|
|
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
|
unsafe {
|
|
nix::libc::malloc_trim(0);
|
|
}
|
|
println!(
|
|
"run {i}: {:?}, sleeping for 5 secs",
|
|
res.selected_items.first().map(|x| x.output())
|
|
);
|
|
std::thread::sleep(std::time::Duration::from_secs(5));
|
|
}
|
|
}
|