Skip to content

Commit

Permalink
Return proper error when aborting TUI project loader
Browse files Browse the repository at this point in the history
  • Loading branch information
adambabik committed Dec 29, 2023
1 parent 3733688 commit 064e483
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion internal/cmd/project_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (pl projectLoader) loadInTerminal(proj *project.Project, onlyFiles bool) ([
resultModel := result.(loadTasksModel)

if resultModel.err != nil {
return nil, nil, err
return nil, nil, resultModel.err
}

return resultModel.files, resultModel.tasks, nil
Expand Down
10 changes: 5 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func root() (status int) {

rootWithCPUProfile(func() {
if err := root.Execute(); err != nil {
logf("could not execute command: %v", err)
logf("could not execute command: %v\n", err)
status = 1
}
})
Expand All @@ -32,12 +32,12 @@ func rootWithCPUProfile(fn func()) {
if profile := os.Getenv("RUNME_PROFILE_CPU"); profile != "" {
f, err := os.Create(profile)
if err != nil {
fatalf("could not create CPU profile: %v", err)
fatalf("could not create CPU profile: %v\n", err)
}
defer f.Close()

if err := pprof.StartCPUProfile(f); err != nil {
fatalf("could not start CPU profile: %v", err)
fatalf("could not start CPU profile: %v\n", err)
}
defer pprof.StopCPUProfile()
}
Expand All @@ -47,14 +47,14 @@ func rootWithCPUProfile(fn func()) {
if profile := os.Getenv("RUNME_PROFILE_MEM"); profile != "" {
f, err := os.Create(profile)
if err != nil {
fatalf("could not create mem profile: %v", err)
fatalf("could not create mem profile: %v\n", err)
}
defer f.Close()

runtime.GC()

if err := pprof.WriteHeapProfile(f); err != nil {
fatalf("could not write heap profile: %v", err)
fatalf("could not write heap profile: %v\n", err)
}
}
}
Expand Down

0 comments on commit 064e483

Please sign in to comment.