fix(rm): use Container.IsRunning() for the force prompt

strings.Contains(container.Status, "Up") missed podman's lowercase
"running" status, leaving the force prompt unreachable under podman.
IsRunning() matches both docker ("Up …") and podman ("running").

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
This commit is contained in:
Luca Di Maio
2026-06-25 09:07:24 +02:00
parent 556c8bb2ec
commit 699a6eba75
+1 -1
View File
@@ -109,7 +109,7 @@ func (c *RmCommand) removeContainer(
userHome string, userHome string,
) error { ) error {
forceRemove := force forceRemove := force
if !forceRemove && !noTTY && strings.Contains(container.Status, "Up") { if !forceRemove && !noTTY && container.IsRunning() {
// Shell defaults this prompt to "yes" (distrobox-rm:424-426). // Shell defaults this prompt to "yes" (distrobox-rm:424-426).
if c.prompter.Prompt("Container is running, do you want to force delete it?", true) { if c.prompter.Prompt("Container is running, do you want to force delete it?", true) {
forceRemove = true forceRemove = true