@ac-essentials/misc-util
    Preparing search index...

    Class ProcessPidFile

    Class to manage a PID file for the current process.

    This class provides methods to write the current process PID to a specified file and to remove the PID file when it is no longer needed.

    Note: The PID file is automatically removed when the process exits, if it was created by this class instance.

    Example usage:

    const pidFile = new ProcessPidFile("/var/run/myapp.pid");
    await pidFile.write();
    // ... application logic ...
    await pidFile.remove();
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Writes the current process PID to the PID file and sets up a handler to remove the PID file on process exit.

      Note: If the process crashes or is forcefully terminated, the PID file may not be removed. In such cases, manual cleanup may be necessary.

      This method ensures that the directory for the PID file exists before writing the file.

      Returns Promise<void>