Hyperlinkv0.8.0-beta.28

NodeRuntime

(options?: {
  readonly disableErrorReporting?: boolean | undefined
  readonly teardown?: Runtime.Teardown | undefined
}): <E, A>(effect: Effect<A, E>) => void
<E, A>(
  effect: Effect<A, E>,
  options?: {
    readonly disableErrorReporting?: boolean | undefined
    readonly teardown?: Runtime.Teardown | undefined
  }
): void

Helps you run a main effect with built-in error handling, logging, and signal management.

When to use

Use to run a Node.js application's main Effect with structured error handling, log management, interrupt support, or advanced teardown capabilities.

Details

This function launches an Effect as the main entry point, setting exit codes based on success or failure, handling interrupts (e.g., Ctrl+C), and optionally logging errors. By default, it logs errors and uses a "pretty" format, but both behaviors can be turned off. You can also provide custom teardown logic to finalize resources or produce different exit codes.

The optional configuration object can include:

  • disableErrorReporting: Turn off automatic error logging.
  • teardown: Provide custom finalization logic.
running
export const runMain: {
  (
    options?: {
      readonly disableErrorReporting?: boolean | undefined
      readonly teardown?: Runtime.Teardown | undefined
    }
  ): <E, A>(effect: Effect<A, E>) => void
  <E, A>(
    effect: Effect<A, E>,
    options?: {
      readonly disableErrorReporting?: boolean | undefined
      readonly teardown?: Runtime.Teardown | undefined
    }
  ): void
} = NodeRuntime.runMain