fixup! feat(podman_driver): Invoke sudo when needed for privileged

This commit is contained in:
Tom van Dijk 2025-03-13 16:20:10 +01:00 committed by Gerald Pinder
parent 9963758a91
commit 1bd8e926b4

View file

@ -520,9 +520,14 @@ impl RunDriver for PodmanDriver {
}
fn podman_run(opts: &RunOpts, cid_file: &Path) -> Command {
let argv0 = if opts.privileged && !nix::unistd::Uid::effective().is_root() {
"sudo"
} else {
"podman"
};
let command = cmd!(
if opts.priviledged && !nix::unistd::Uid::effective().is_root() => "sudo",
"podman",
argv0,
if argv0 != "podman" => "podman",
"run",
format!("--cidfile={}", cid_file.display()),
if opts.privileged => [