Skip to main content

disposeAndExit

@rotorsoft/act-root


@rotorsoft/act-root / act/src / disposeAndExit

Function: disposeAndExit()

disposeAndExit(code?): Promise<void>

Defined in: libs/act/src/ports.ts:212

Disposes all registered adapters and disposers, then exits the process.

Execution order:

  1. Custom disposers (registered via dispose) — in reverse order
  2. Port adapters (log, store, cache) — in reverse registration order
  3. Adapter registry is cleared
  4. Process exits (skipped in test environment)

In production, "ERROR" exits are silently ignored to avoid crashing on transient failures (e.g. an uncaught promise in a non-critical path).

Parameters

code?

"ERROR" | "EXIT"

Exit code: "EXIT" for clean shutdown (exit 0), "ERROR" for abnormal termination (exit 1)

Returns

Promise<void>