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

Treat KeyboardInterrupt exception as != YES #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

szaydel
Copy link

@szaydel szaydel commented Aug 30, 2021

It looks like right now when a confirmation is interrupted via CTRL-C, it results in a crash that looks like the following, as a result of not handling a KeyboardInterrupt exception raised by readline.

$ corelight-client smartpcap storage shutdown

== Confirmation required ==

This will shutdown Smart PCAP external storage, which requires sensor reboot to resume the capture function.

== To proceed, enter 'YES': ^CTraceback (most recent call last):
  File "/usr/bin/corelight-client", line 197, in <module>
    client.resource.process(session, resource)
  File "/usr/local/python38/lib/python3.8/site-packages/client/resource.py", line 250, in process
    _processResponse(session, resource, response, schema, cache, data)
  File "/usr/local/python38/lib/python3.8/site-packages/client/resource.py", line 334, in _processResponse
    if sys.stdin.readline() != "YES\n":
KeyboardInterrupt

With this change it feels a bit more pleasant:

$ corelight-client smartpcap storage shutdown

== Confirmation required ==

This will shutdown Smart PCAP external storage, which requires sensor reboot to resume the capture function.

== To proceed, enter 'YES': ^C
== Aborted

@szaydel
Copy link
Author

szaydel commented May 21, 2024

Wow, this took a while @perkinjo . I forgot all about this PR. :)

Thank you, Sam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants