Skip to content
This repository has been archived by the owner on Nov 2, 2022. It is now read-only.

handle SystemExit exceptions in excepthook #15

Open
njsmith opened this issue Jan 29, 2019 · 1 comment
Open

handle SystemExit exceptions in excepthook #15

njsmith opened this issue Jan 29, 2019 · 1 comment

Comments

@njsmith
Copy link
Member

njsmith commented Jan 29, 2019

The old MultiError code didn't have to worry about this, because of unwrapping, but we do. If a program terminates with an ExceptionGroup that consists of only SystemExit exceptions, then it should terminate silently.

@njsmith
Copy link
Member Author

njsmith commented Jan 29, 2019

Oh, and we have to handle the argument correctly, which can either be an integer exit code, or a string to print. This might be tricky for multiple SystemExits in the same group... Which is probably fine, that's a weird edge case anyway, we just have to decide what to do with it. The main thing is that this should work as expected:

async def get_outta_here():
    sys.exit(...)

async def main():
    async with trio.open_nursery() as nursery:
        nursery.start_soon(get_outta_here)

trio.run(main)

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

No branches or pull requests

1 participant