Effect CommunityEC
Effect Communityβ€’3y agoβ€’
26 replies
timbotronic

Persistent Forked Fibre Process

As part of any healthy diet, i've been trying to consume fibres. here's a fun little problem i've been having: The process i launch in a forked fibre won't die!
Consider the dummy code:
const command = Command.make("geth", "--dev").pipe(
  Command.start,
  Effect.tap(() => console.log("started")),
  Effect.fork
);

const programGeth = Effect.gen(function* (_) {
  const fiber = yield* _(command);
  yield* _(Effect.sleep(2000));
  yield* _(Fiber.interrupt(fiber));
  console.log("killed");
}).pipe(Effect.provide(NodeContext.layer));

Runtime.runMain(programGeth);


After this toy example, the program will exit but the geth binary will still be running on the machine
Was this page helpful?