diff --git a/cmd/omniflixhubd/cmd/root.go b/cmd/omniflixhubd/cmd/root.go index 42492b9..73a6e25 100644 --- a/cmd/omniflixhubd/cmd/root.go +++ b/cmd/omniflixhubd/cmd/root.go @@ -2,6 +2,7 @@ package cmd import ( "errors" + "fmt" "io" "os" "path/filepath" @@ -73,6 +74,9 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { if err := tempApp.Close(); err != nil { panic(err) } + if tempDir != app.DefaultNodeHome { + os.RemoveAll(tempDir) + } }() initClientCtx := client.Context{}. @@ -179,7 +183,14 @@ func addModuleInitFlags(startCmd *cobra.Command) { } func tempDir() string { +<<<<<<< HEAD dir := filepath.Join(os.TempDir(), "."+app.Name+"-temp") +======= + dir, err := os.MkdirTemp("", "."+app.Name+"-temp") + if err != nil { + panic(fmt.Sprintf("failed creating temp directory: %s", err.Error())) + } +>>>>>>> main defer os.RemoveAll(dir) return dir