Skip to content

Commit

Permalink
Create output dir instead of returning error for OCI artifacts (#246)
Browse files Browse the repository at this point in the history
Create output dir instead of returning error for OCI artifacts
  • Loading branch information
FrenchBen authored Nov 16, 2023
1 parent 45fc316 commit 60c918d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/timoni/artifact_pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ func pullArtifactCmdRun(cmd *cobra.Command, args []string) error {

log := LoggerFrom(cmd.Context())

if fs, err := os.Stat(pullArtifactArgs.output); err != nil || !fs.IsDir() {
return fmt.Errorf("invalid output path %s", pullArtifactArgs.output)
if err := os.MkdirAll(pullArtifactArgs.output, os.ModePerm); err != nil {
return fmt.Errorf("invalid output path %s: %w", pullArtifactArgs.output, err)
}

if pullArtifactArgs.verify != "" {
Expand Down
4 changes: 2 additions & 2 deletions cmd/timoni/mod_pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ func pullCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("invalid output path %s", pullModArgs.output)
}

if fs, err := os.Stat(pullModArgs.output); err != nil || !fs.IsDir() {
return fmt.Errorf("invalid output path %s", pullModArgs.output)
if err := os.MkdirAll(pullModArgs.output, os.ModePerm); err != nil {
return fmt.Errorf("invalid output path %s: %w", pullModArgs.output, err)
}

log := LoggerFrom(cmd.Context())
Expand Down

0 comments on commit 60c918d

Please sign in to comment.