Additional help test when container.RunDir already exists

- Closes #1389

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2024-09-19 11:40:10 -06:00
parent cd39a766d8
commit 836b791d74
2 changed files with 5 additions and 2 deletions

View File

@@ -53,6 +53,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Correctly extract smbios asset key during Grub boot. #1291
- Refactor of `wwinit/init` to more properly address rootfs options. #1098
### Added
- Additional help test when container.RunDir already exists. #1389
## v4.5.7, 2024-09-11
### Added

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)
}