JonathanSalwan/ROPgadget

Don't call sys.exit from Args.__parse

Grazfather opened this issue · 0 comments

By calling sys.exit directly from Args.__parse, which is called from the constructor you make it difficult for one to programmatically build args.

I would suggest instead having __parse raise an exception. This could be explicitly handled in any caller, the only one in your library itself being the CLI.

It would basically be changing 5 exit lines to raise Exceptions instead, and ropgadget.main to catch this exception. Instead of printing the error message directly you could of course also pass the message to the Exception's constructor and print it in main.