mirror of
https://github.com/IAmTomShaw/f1-race-replay.git
synced 2026-05-09 08:25:56 +02:00
[GH-ISSUE #54] --list-rounds and --list-sprints flags don't exit after execution #12
Labels
No labels
bug
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/f1-race-replay#12
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Mithurn on GitHub (Dec 16, 2025).
Original GitHub issue: https://github.com/IAmTomShaw/f1-race-replay/issues/54
When using the
--list-roundsor--list-sprintsflags, the program correctly lists the rounds but then continues to execute themain()function, causing errors or unexpected behavior.Expected Behavior:
The program should display the list of rounds and exit cleanly.
Actual Behavior:
The program lists the rounds, then attempts to load session data for the default round, which is unnecessary and may cause errors.
Suggested Fix
Add [sys.exit(0)]
after the list functions:
if "--list-rounds" in sys.argv:
list_rounds(year)
sys.exit(0)
elif "--list-sprints" in sys.argv:
list_sprints(year)
sys.exit(0)
@IAmTomShaw commented on GitHub (Dec 16, 2025):
That's odd. They exit on my main branch
@IAmTomShaw commented on GitHub (Dec 16, 2025):
Lines 845 and 863 exit the application. I suppose we could move the exits to the main.py file to make things look neater
@Keshav02-rk commented on GitHub (Dec 16, 2025):
Thanks for the clarification! I agree that moving the
sys.exit(0)calls intomain.pywould make the behavior more explicit and easier to follow. This would also help prevent confusion for contributors using the--list-roundsand--list-sprintsflags. I can help implement this if needed and open a PR for the change.@Mithurn commented on GitHub (Dec 17, 2025):
Thanks for the clarification! I've opened PR #55 which implements your suggestion to move the [sys.exit(0)] calls into main.py. This makes the exit behavior more explicit and easier to follow.
Currently, the code has [sys.exit()] calls in both locations:
Lines 845 and 863 in [f1_data.py] (within the [list_rounds] and [list_sprints] functions)
Lines 84 and 87 in [main.py] (after calling these functions)
Should I also remove the [sys.exit()] calls from [f1_data.py] to avoid the redundancy?
@Keshav02-rk commented on GitHub (Dec 17, 2025):
I’d suggest removing the sys.exit() calls from f1_data.py and keeping the exit logic only in main.py. That keeps helper functions side-effect free and makes the flow easier to follow.
@IAmTomShaw commented on GitHub (Dec 18, 2025):
This issue has been resolved now :)