Skip to content

Commit 8081f74

Browse files
fix: logic to handle interrupt before timeout in error checking (#918)
- Reorder conditions to check ErrInterrupted before ErrProgramKilled - Prevents Ctrl+C from being incorrectly treated as timeout
1 parent 181be44 commit 8081f74

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ func main() {
7878
if errors.As(err, &ex) {
7979
os.Exit(int(ex))
8080
}
81+
if errors.Is(err, tea.ErrInterrupted) {
82+
os.Exit(exit.StatusAborted)
83+
}
8184
if errors.Is(err, tea.ErrProgramKilled) {
8285
fmt.Fprintln(os.Stderr, "timed out")
8386
os.Exit(exit.StatusTimeout)
8487
}
85-
if errors.Is(err, tea.ErrInterrupted) {
86-
os.Exit(exit.StatusAborted)
87-
}
8888
fmt.Fprintln(os.Stderr, err)
8989
os.Exit(1)
9090
}

0 commit comments

Comments
 (0)