Skip to content

Commit

Permalink
fix: 🐛 (#23) fix issue with ctrl+c
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasAugustin committed Aug 18, 2023
1 parent 9478e49 commit 3432b04
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
11 changes: 7 additions & 4 deletions pkg/ui/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,17 @@ func ListRun[K interface{ FilterValue() string }](settings ListSettings, input [

p := tea.NewProgram(&m, tea.WithAltScreen())

_, err := p.Run()

if err != nil {
log.Errorf("Error running program %s", err)
os.Exit(1)
}

if m.quitting {
log.Warn("ctrl + c pressed -> quitting")
os.Exit(0)
}

if _, err := p.Run(); err != nil {
log.Errorf("Error running program %s", err)
os.Exit(1)
}
return m.choice
}
9 changes: 5 additions & 4 deletions pkg/ui/spinner.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,16 @@ func (s *Spinner) Run() {
go func() {
_, err := s.program.Run()

if err != nil {
fmt.Println(err)
os.Exit(1)
}

if s.model.quitting {
log.Warn("ctrl + c -> quitting")
os.Exit(0)
}

if err != nil {
fmt.Println(err)
os.Exit(1)
}
}()

}
Expand Down

0 comments on commit 3432b04

Please sign in to comment.