Skip to content

state machine bug: calls shutdown if start fails #103

Closed
@weissi

Description

@weissi

consider this code

        service.register(label: "thing",
                         start: .sync {
            print("THIS WILL FAIL")
            struct SomeError: Error {}
            throw SomeError()
        },
                         shutdown: .sync {
            print("SHUTDOWN <<< SHOULD NEVER HAPPEN")
        },
        shutdownIfNotStarted: false)

        try service.startAndWait()

clearly, it should never invoke the shutdown handler because the start one failed but it still will. It prints:

THIS WILL FAIL
SHUTDOWN <<< SHOULD NEVER HAPPEN

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugFeature doesn't work as expected.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions