Effect CommunityEC
Effect Community3y ago
9 replies
timbotronic

Crash when rejoining scoped Fiber

Command fails when rejoin scoped fiber. Using the following code will execute in platform-node version 0.33.2 but crashes in 0.33.3 & 0.33.4
import { Command, NodeContext, Runtime } from "@effect/platform-node";
import { Effect, Fiber } from "effect";

const programScope2 = Effect.gen(function* (_) {
  console.log("running programScope2");
  yield* _(launchNode);
  console.log("killing node");
});

const launchNode = Effect.gen(function* (_) {
  const command = Command.make("geth", "--dev").pipe(
    Command.start,
    Effect.tap(() => console.log("started")),
    Effect.fork
  );

  const fiber = yield* _(command);
  yield* _(Effect.sleep(2000));

  const process = yield* _(Fiber.join(fiber));

  return { process };
}).pipe(Effect.provide(NodeContext.layer));

Runtime.runMain(programScope2);
Was this page helpful?