Merge pull request #1406 from anderbubble/1389-rundir-help-text

Additional help test when container.RunDir already exists
This commit is contained in:
Christian Goll
2024-09-25 11:10:22 +02:00
committed by GitHub
2 changed files with 5 additions and 2 deletions

View File

@@ -4,7 +4,6 @@
package exec
import (
"errors"
"fmt"
"os"
"os/exec"
@@ -42,7 +41,7 @@ func runContainedCmd(cmd *cobra.Command, containerName string, args []string) (e
runDir := container.RunDir(containerName)
if err := os.Mkdir(runDir, 0750); err != nil {
if _, existerr := os.Stat(runDir); !os.IsNotExist(existerr) {
return errors.New("run directory already exists: another container command may already be running")
return fmt.Errorf("run directory already exists: another container command may already be running (otherwise, remove %s)", runDir)
} else {
return fmt.Errorf("unable to create run directory: %w", err)
}