Skip to content

Cleanup on SIGINT & uncaughtException #3

@ajmas

Description

@ajmas

Would it be worth supporting cleanup on non-normal process exit, such that:

/** Removes the PID file on normal process exit. */
Pid.prototype.removeOnExit = function() {
    // do something when app is closing
    process.on('exit', this.remove.bind(this));
    // catches ctrl+c event
    process.on('SIGINT', this.remove.bind(this));
    // catches uncaught exceptions
    process.on('uncaughtException', this.remove.bind(this));
};

When doing development I find that the process file remains when I hit ctrl-c.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions