I have simple Rust application which run a for loop and calls thread::sleep() API after every iteration of for loop.
Expected: in non-interactive mode, contianer must run this app and print sleeping 1,2, … and finally print After sleep.
Problem: In non-interactive mode, contianer exits only after 1st call to sleep() API and does not execute any statement after first sleep() call inside for loop.
Base Image : Alpine latest (the problem is also observed in Debian latest so its nothing with distro)
pub fn run_test(&mut self) -> Result<Vec<TestResult>, Error> {
log::info!("Starting test...");
for i in 1..=5 {
println!("Sleeping... {i}");
stdout().flush().unwrap();
thread::sleep(Duration::from_secs(1));
}
log::info!("After sleep ---------------");
log::info!("test completed.");
stdout().flush().unwrap();
Ok(ghost_list)
}
Thanks,
- Bhaskar