diff --git a/doc/podman-pilot.rst b/doc/podman-pilot.rst index e4cf7b4..de82631 100644 --- a/doc/podman-pilot.rst +++ b/doc/podman-pilot.rst @@ -148,6 +148,10 @@ OPTIONS even if there are files missing. This can lead to a non functional instance of course, you have been warned. +%interactive + + Use when running interactive processes like a shell + DEBUGGING --------- diff --git a/podman-pilot/src/podman.rs b/podman-pilot/src/podman.rs index 6e79898..8a7ddf9 100644 --- a/podman-pilot/src/podman.rs +++ b/podman-pilot/src/podman.rs @@ -33,6 +33,7 @@ use flakes::command::{CommandError, CommandExtTrait}; use flakes::container::Container; use flakes::config::get_podman_ids_dir; +use std::io; use std::path::Path; use std::process::{Command, Output, Stdio}; use std::env; @@ -477,8 +478,15 @@ pub fn call_instance( let RuntimeSection { resume, .. } = config().runtime(); + let pilot_options = Lookup::get_pilot_run_options(); + let mut interactive = false; + if pilot_options.contains_key("%interactive") { + interactive = true; + } + let mut call = user.run("podman"); - if action == "rm_force" { + if action == "rm" || action == "rm_force" { + call.stdout(Stdio::null()); call.arg("rm").arg("--force"); } else { call.arg(action); @@ -508,18 +516,19 @@ pub fn call_instance( if Lookup::is_debug() { debug!("{:?}", call.get_args()); } - if action == "rm" || action == "rm_force" { - match call.perform() { + if interactive { + call.status()?; + } else { + match call.output() { Ok(output) => { - output - } + let _ = io::stdout().write_all(&output.stdout); + let _ = io::stderr().write_all(&output.stderr); + }, Err(_) => { let _ = Container::podman_setup_permissions(); - call.perform()? + call.output()?; } }; - } else { - call.status()?; } Ok(()) }