Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully handle Ctrl+C in all CLI commands #1501

Open
RhetTbull opened this issue Apr 7, 2024 · 0 comments
Open

Gracefully handle Ctrl+C in all CLI commands #1501

RhetTbull opened this issue Apr 7, 2024 · 0 comments
Labels
cli Pertains to the command line interface feature request New feature or request

Comments

@RhetTbull
Copy link
Owner

Hitting Ctrl+C while a CLI command is running yields a traceback like below. It would be better to catch this and gracefully exit with a nice message like "Aborted!" or such instead of a full traceback.

^CTraceback (most recent call last):
  File "/Users/rhet/.local/bin/osxphotos", line 5, in <module>
    from osxphotos.__main__ import cli_main
  File "/Users/rhet/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/__init__.py", line 13, in <module>
    from .exifwriter import ExifWriter
  File "/Users/rhet/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/exifwriter.py", line 19, in <module>
    from .exportoptions import ExportOptions
  File "/Users/rhet/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/exportoptions.py", line 10, in <module>
    from .export_db import ExportDB
  File "/Users/rhet/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/export_db.py", line 29, in <module>
    from .fileutil import FileUtil
  File "/Users/rhet/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/fileutil.py", line 12, in <module>
    from .imageconverter import ImageConverter
  File "/Users/rhet/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/osxphotos/imageconverter.py", line 18, in <module>
    import Quartz
  File "/Users/rhet/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/Quartz/__init__.py", line 47, in <module>
    globals().pop("_setup")()
  File "/Users/rhet/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/Quartz/__init__.py", line 10, in _setup
    from . import (
  File "/Users/rhet/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/Quartz/QuickLookUI/__init__.py", line 46, in <module>
    globals().pop("_setup")()
  File "/Users/rhet/.local/pipx/venvs/osxphotos/lib/python3.11/site-packages/Quartz/QuickLookUI/__init__.py", line 15, in _setup
    from . import _metadata, _QuickLookUI
KeyboardInterrupt
@RhetTbull RhetTbull added feature request New feature or request cli Pertains to the command line interface labels Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Pertains to the command line interface feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant