Configuring ManagedRuntime to Auto-Dispose Like Effect.runPromise

is there a way to configure a ManagedRuntime so that it disposes the same way that would naturally happen by just running Effect.runPromise?

I have this runtime that is basically what i need to run my cli scripts (things like wrapping drizzle kit, better auth cli, etc.). previously for each script i would provide each required layer, and then Effect.runPromise. now i'm just doing RuntimeCli.runPromise, but then this hangs unless I do void RuntimeCli.dispose(); at the end. but when i was previously using the default runtime via Effect.runPromise, I didn't need this dispose step. is there anyway to inherit that behavior in my runtime?
export const DotEnvConfigProvider =
  createConfigProviderFromDotEnv("../../.env");

export const RuntimeCli = NodeContext.layer
  .pipe(Layer.merge(DatabaseLive))
  .pipe(Layer.merge(Users.Default))
  .pipe(Layer.provide(DotEnvConfigProvider))
  .pipe(ManagedRuntime.make);
Was this page helpful?