mirror of
https://github.com/89luca89/distrobox.git
synced 2026-08-18 17:04:48 -05:00
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:
+1
-1
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user