def main():
    try:
        _setup()
        return _run_server()
    except SystemExit as exit_code:
        sys.exit(exit_code)
    except __HOLE__:
        listener = get_listener_if_set()

        if listener:
            listener.shutdown()
    except Exception:
        LOG.exception('(PID=%s) ST2 Stream API quit due to exception.', os.getpid())
        return 1
    finally:
        _teardown()
dataset/ETHPy150Open StackStorm/st2/st2stream/st2stream/cmd/api.py/main