lotus-provider: Remove stray ~ dir in repo, fix bug causing it

This commit is contained in:
Łukasz Magiera 2023-12-18 18:46:37 +01:00
parent b363bc3e70
commit b1c1839b57
3 changed files with 14 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import (
"github.com/fatih/color" "github.com/fatih/color"
logging "github.com/ipfs/go-log/v2" logging "github.com/ipfs/go-log/v2"
"github.com/mitchellh/go-homedir"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
@ -144,8 +145,14 @@ func main() {
}, },
After: func(c *cli.Context) error { After: func(c *cli.Context) error {
if r := recover(); r != nil { if r := recover(); r != nil {
p, err := homedir.Expand(c.String(FlagMinerRepo))
if err != nil {
log.Errorw("could not expand repo path for panic report", "error", err)
panic(r)
}
// Generate report in LOTUS_PATH and re-raise panic // Generate report in LOTUS_PATH and re-raise panic
build.GeneratePanicReport(c.String("panic-reports"), c.String(deps.FlagRepoPath), c.App.Name) build.GeneratePanicReport(c.String("panic-reports"), p, c.App.Name)
panic(r) panic(r)
} }
return nil return nil

View File

@ -7,6 +7,7 @@ import (
"path/filepath" "path/filepath"
logging "github.com/ipfs/go-log/v2" logging "github.com/ipfs/go-log/v2"
"github.com/mitchellh/go-homedir"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
@ -41,6 +42,11 @@ func OpenFSJournal(lr repo.LockedRepo, disabled journal.DisabledEvents) (journal
} }
func OpenFSJournalPath(path string, disabled journal.DisabledEvents) (journal.Journal, error) { func OpenFSJournalPath(path string, disabled journal.DisabledEvents) (journal.Journal, error) {
path, err := homedir.Expand(path)
if err != nil {
return nil, xerrors.Errorf("failed to expand repo path: %w", err)
}
dir := filepath.Join(path, "journal") dir := filepath.Join(path, "journal")
if err := os.MkdirAll(dir, 0755); err != nil { if err := os.MkdirAll(dir, 0755); err != nil {
return nil, fmt.Errorf("failed to mk directory %s for file journal: %w", dir, err) return nil, fmt.Errorf("failed to mk directory %s for file journal: %w", dir, err)