pub fn docker_run<A, S, F, R>(args: A, f: F) -> R
where
    A: IntoIterator<Item = S>,
    S: AsRef<OsStr>,
    F: FnOnce() -> R + panic::UnwindSafe,
{
    let container_id = exec_docker_command("run", args);
    let result = panic::catch_unwind(f);

    if result.is_err() {
        let logs = exec_docker_command("logs", &[&container_id]);

        println!("\n---- docker stdout ----");
        println!("{}", logs);
    }

    exec_docker_command("kill", &[&container_id]);

    match result {
        Ok(res) => res,
        Err(err) => panic::resume_unwind(err),
    }
}
/// Invoke `docker run` with the given arguments, calling the provided function
/// after the container has booted and terminating the container after the
/// provided function completes, catching panics and propagating them to ensure
/// that the container reliably shuts down.
///
/// Prints log output from the container in the event an error occurred.
Invoke `docker run` with the given arguments, calling the provided function
after the container has booted and terminating the container after the
provided function completes, catching panics and propagating them to ensure
that the container reliably shuts down.

Prints log output from the container in the event an error occurred.
Invoke ` docker run ` with the given arguments calling the provided function after the container has booted and terminating the container after the provided function completes catching panics and propagating them to ensure that the container reliably shuts down . Prints log output from the container in the event an error occurred .
pub fn docker_run<A, S, F, R>(args: A, f: F) -> R
where
    A: IntoIterator<Item = S>,
    S: AsRef<OsStr>,
    F: FnOnce() -> R + panic::UnwindSafe,
{
    let container_id = exec_docker_command("run", args);
    let result = panic::catch_unwind(f);
    if result.is_err() {
        let logs = exec_docker_command("logs", &[&container_id]);
        println!("\n---- docker stdout ----");
        println!("{}", logs);
    }
    exec_docker_command("kill", &[&container_id]);
    match result {
        Ok(res) => res,
        Err(err) => panic::resume_unwind(err),
    }
}
pub fn docker_run < A , S , F , R > ( args : A , f : F ) -> R where A : IntoIterator < Item = S > , S : AsRef < OsStr > , F : FnOnce ( ) -> R + panic :: UnwindSafe , { let container_id = exec_docker_command ( " " , args ) ; let result = panic :: catch_unwind ( f ) ; if result . is_err ( ) { let logs = exec_docker_command ( " " , & [ & container_id ] ) ; println ! ( " \n " ) ; println ! ( " " logs ) ; } exec_docker_command ( " " , & [ & container_id ] ) ; match result { Ok ( res ) => res , Err ( err ) => panic :: resume_unwind ( err ) , } }
Invoke `docker run` with the given arguments, calling the provided function
after the container has booted and terminating the container after the
provided function completes, catching panics and propagating them to ensure
that the container reliably shuts down.
Invoke ` docker run ` with the given arguments calling the provided function after the container has booted and terminating the container after the provided function completes catching panics and propagating them to ensure that the container reliably shuts down .
args
A
f
F
args
A
f
F