Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed podman call dead lock #55

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/podman-pilot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------

Expand Down
25 changes: 17 additions & 8 deletions podman-pilot/src/podman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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(())
}
Expand Down
Loading