Skip to content

Commit

Permalink
really removes tmp dir after cli run
Browse files Browse the repository at this point in the history
  • Loading branch information
swelf19 committed Nov 8, 2024
1 parent 511867e commit c909f72
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/neutrond/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
// create a temporary application for use in constructing query + tx commands
initAppOptions := viper.New()
tempDir := tempDir()
// cleanup temp dir after we are done with the tempApp, so we don't leave behind a
// new temporary directory for every invocation. See https://github.com/CosmWasm/wasmd/issues/2017
defer os.RemoveAll(tempDir)
initAppOptions.Set(flags.FlagHome, tempDir)
tempApplication := app.New(
log.NewNopLogger(),
Expand Down Expand Up @@ -139,7 +142,6 @@ func tempDir() string {
if err != nil {
dir = app.DefaultNodeHome
}
defer os.RemoveAll(dir)

return dir
}
Expand Down

0 comments on commit c909f72

Please sign in to comment.