Skip to content

Add hook mechanism to quit command #518

@guang384

Description

@guang384

Many times, I think it is not the best choice to re implement the exit command by inherit Quit and implement Quit.Command.

In most cases, I just want to perform some cleanup when issuing the exit command. I suggest that you can consider referring to the shutdown hook method of the runtime.

Runtime.getRuntime().addShutdownHook( () -> System.out.println("I'm shutdown hook...") );

Can you consider adding a "QuitCommandHook" mechanism instead of always rewriting the quit class to perform exit cleanup logic. The way envisaged is similar to:
Quit.addCommandHook( () -> System.out.println("I'm shutdown hook...") );

If possible, I would be happy to submit a PR on this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions