Skip to content

Commit

Permalink
fix: check if cachedir is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterSchafer committed Jan 24, 2023
1 parent ae2a087 commit e67f8b4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions cliv2/cmd/cliv2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ func MainWithErrorCode() int {

debugLogger.Println("Organization:", config.GetString(configuration.ORGANIZATION))
debugLogger.Println("API:", config.GetString(configuration.API_URL))
debugLogger.Println("Cache directory:", config.GetString(configuration.CACHE_PATH))
debugLogger.Println("Insecure HTTPS:", config.GetBool(configuration.INSECURE_HTTPS))

// init NetworkAccess
networkAccess := engine.GetNetworkAccess()
Expand Down
12 changes: 7 additions & 5 deletions cliv2/internal/cliv2/cliv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@ func NewCLIv2(cacheDirectory string, debugLogger *log.Logger) (*CLI, error) {
func (c *CLI) Init() (err error) {
c.DebugLogger.Println("Init start")

// ensure the specified base cache directory exists, this needs to be done even before acquiring the lock
if _, err = os.Stat(c.CacheDirectory); os.IsNotExist(err) {
err = os.Mkdir(c.CacheDirectory, local_utils.CACHEDIR_PERMISSION)
if err != nil {
return err
if len(c.CacheDirectory) > 0 {
// ensure the specified base cache directory exists, this needs to be done even before acquiring the lock
if _, err = os.Stat(c.CacheDirectory); os.IsNotExist(err) {
err = os.Mkdir(c.CacheDirectory, local_utils.CACHEDIR_PERMISSION)
if err != nil {
return err
}
}
}

Expand Down
2 changes: 0 additions & 2 deletions cliv2/pkg/basic_workflows/legacycli.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ func legacycliWorkflow(invocation workflow.InvocationContext, input []workflow.D
}

debugLogger.Println("Arguments:", args)
debugLogger.Println("Cache directory:", cacheDirectory)
debugLogger.Println("Insecure HTTPS:", insecure)
debugLogger.Println("Use StdIO:", useStdIo)

// init cli object
Expand Down

0 comments on commit e67f8b4

Please sign in to comment.