Skip to content

Commit

Permalink
fix: multiple temp directories on cli command executions (#190)
Browse files Browse the repository at this point in the history
* update readme

* go.mod: bump up wasmd

* update readme (#187)

* fix node temp home issue

* fix temp directories issue
  • Loading branch information
harish551 authored Sep 20, 2024
1 parent 765e962 commit 6195561
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions cmd/omniflixhubd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"errors"
"fmt"
"io"
"os"

Expand Down Expand Up @@ -72,6 +73,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{}.
Expand Down Expand Up @@ -178,9 +182,9 @@ func addModuleInitFlags(startCmd *cobra.Command) {
}

func tempDir() string {
dir, err := os.MkdirTemp("", "omniflixhubtemp")
dir, err := os.MkdirTemp("", "."+app.Name+"-temp")
if err != nil {
dir = app.DefaultNodeHome
panic(fmt.Sprintf("failed creating temp directory: %s", err.Error()))
}
defer os.RemoveAll(dir)

Expand Down
5 changes: 3 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ OmniFlix Hub blockchain is built using Cosmos-SDK and CometBFT
```
sudo rm -rf /usr/local/go
wget -q -O - https://git.io/vQhTU | bash -s -- --remove
wget -q -O - https://git.io/vQhTU | bash -s -- --version 1.21.3
wget -q -O - https://git.io/vQhTU | bash -s -- --version 1.22.5
```

### Installation
Expand All @@ -24,7 +24,7 @@ wget -q -O - https://git.io/vQhTU | bash -s -- --version 1.21.3
```
git clone https://github.com/Omniflix/omniflixhub.git
cd omniflixhub
git checkout v4.1.1
git checkout v5.0.0
go mod tidy
make install
```
Expand Down Expand Up @@ -77,6 +77,7 @@ curl https://raw.githubusercontent.com/OmniFlix/mainnet/main/omniflixhub-1/genes
- [v3]((https://github.com/OmniFlix/docs/blob/main/guides/mainnet/omniflixhub-1/upgrades/v3-upgrade.md)) at block 10872800
- [v3.3.0]((https://github.com/OmniFlix/docs/blob/main/guides/mainnet/omniflixhub-1/upgrades/v3.3.0-upgrade.md)) at block 11140000
- [v4]((https://github.com/OmniFlix/docs/blob/main/guides/mainnet/omniflixhub-1/upgrades/v4-upgrade.md)) at block 11914000
- [v5](https://github.com/OmniFlix/docs/blob/main/guides/mainnet/omniflixhub-1/upgrades/v5-upgrade.md) at block 13986200

### Testnets

Expand Down

0 comments on commit 6195561

Please sign in to comment.