Skip to content

Spawn a separate process using the system's Python to track when ST is closed and allow cleanups #128

@FichteFoll

Description

@FichteFoll

This is something that ST just cannot do at the moment and thus leaves plugins mostly struggling to clean up their resources or whatever. Because it's something that can be reused easily and only needs a single guardian process, there should be a centralized solution and sublime_lib provides a good opportunity to do so.

In essence:

  1. Provide an interface that users can call with the path to an executable (script) that will be run once it is detected that ST has been shut down. Also pass provided arguments to the subprocess call.
  2. On the first of such call, spawn a subprocess using the system python that will monitor its parent existence and has a communication channel with the plugin so that more on_exit executables can be added.
  3. Once ST has been closed, run the specified scripts with the respective arguments in parallel.

Optional: Log errors or failed calls in some log file, probably in the cache.

I suppose using standard pipes for communication and declaring ST as having closed when the pipe is broken works, too.

Related: sublimehq/sublime_text#2950

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions