From c909f722f917f9d602146b8bdd5fe48026e098e0 Mon Sep 17 00:00:00 2001 From: swelf Date: Fri, 8 Nov 2024 13:47:09 +0300 Subject: [PATCH] really removes tmp dir after cli run --- cmd/neutrond/root.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/neutrond/root.go b/cmd/neutrond/root.go index 10ef9d36c..883178e3b 100644 --- a/cmd/neutrond/root.go +++ b/cmd/neutrond/root.go @@ -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(), @@ -139,7 +142,6 @@ func tempDir() string { if err != nil { dir = app.DefaultNodeHome } - defer os.RemoveAll(dir) return dir }