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:236

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>