export declare enum Reason { PRE_EXIT = "pre_exit",// Pre-exit phase (not used by default) EXIT = "exit",// Normal process exit SIGINT = "sigint",// Ctrl-C or SIGINT SIGTERM = "sigterm",// SIGTERM SIGHUP = "sighup",// SIGHUP UNCAUGHT_EXCEPTION = "uncaught_exception",// Fatal exception UNHANDLED_REJECTION = "unhandled_rejection",// Unhandled promise rejection MANUAL = "manual" } /** * Detect an EPIPE rejection that originated from an IPC `send()` to a worker * subprocess (`syscall: "send"`), as opposed to a stdin/stdout pipe write * (`syscall: "write"`). Only the IPC-send path can break an optional worker * subsystem without affecting the main process, so only this shape is safe to * swallow at the global `unhandledRejection` level. See issue #2997. */ export declare function isIpcSendEpipe(err: Error): boolean; /** * Register a process cleanup callback, to be run on shutdown, signal, or fatal error. * * Returns a Callback instance that can be used to cancel (unregister) or manually clean up. * If register is called after cleanup already began, invokes callback on a microtask. */ export declare function register(id: string, callback: (reason: Reason) => void | Promise): () => void; /** * Runs all cleanup callbacks without exiting. * Use this in workers or when you need to clean up but continue execution. */ export declare function cleanup(): Promise; /** * Runs all cleanup callbacks and exits. * * In main thread: waits for stdout drain, then calls process.exit(). * In workers: runs cleanup only (process.exit would kill entire process). */ export declare function quit(code?: number): Promise;