Skip to content

Commit

Permalink
Merge pull request #761 from neutron-org/fix/remove-tmp-dir
Browse files Browse the repository at this point in the history
fix: really removes tmp dir after cli run
  • Loading branch information
pr0n00gler authored Nov 11, 2024
2 parents 6b1d54f + c909f72 commit 954660e
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 954660e

Please sign in to comment.