RedHatProductSecurity / cvss

CVSS2/3/4 library with interactive calculator for Python 2 and Python 3
GNU Lesser General Public License v3.0
79 stars 28 forks source link

Gracefully handle ^D and treat it like ^C. #14

Closed iamleot closed 6 years ago

iamleot commented 6 years ago

Previously EOF was not handled and pressing ^D leads to an EOFError exception (for Unix muscle memory is usually handy to just exit via a ^D), e.g.:

% cvss_calculator
Interactive CVSS3 calculator

Attack Vector: Network | Adjacent | Local | Physical
Attack Vector: N/A/L/P ^D
Traceback (most recent call last):
  File "/usr/pkg/bin/cvss_calculator-2.7", line 11, in <module>
    load_entry_point('cvss==1.7', 'console_scripts', 'cvss_calculator')()
  File "/usr/pkg/lib/python2.7/site-packages/cvss/cvss_calculator.py", line 42, in main
    vector_string = ask_interactively(version, args.all, args.no_colors)
  File "/usr/pkg/lib/python2.7/site-packages/cvss/interactive.py", line 98, in ask_interactively
    input_value = string_input().upper()
EOFError

Handle EOFError exception in the same way of KeyboardInterrupt.

skontar commented 6 years ago

Thanks!

iamleot commented 6 years ago

Hello Stanislav,

Stanislav Kontár writes:

Thanks!

Thank you for quickly merging it!

Keep up the good work!