Effect Stream Hangs Forever Without Output
Why does this short example hangs forever and nothing's printed?
import { NodeRuntime } from "@effect/platform-node";
import { Cause, Chunk, Console, Effect, Option, Stream } from "effect";
const stepEffect = Effect.gen(function* () {
yield* Effect.fork(Effect.sleep("10 seconds")); // dom
yield* Effect.fork(
Effect.sleep("1 second").pipe(Effect.flatMap(() => Effect.fail("💥 screenshot failed"))) // shot
);
return Option.some([Chunk.empty(), undefined] as const);
}).pipe(Effect.tapErrorCause((c) => Console.log("INSIDE step tapErrorCause:", Cause.pretty(c))));
const stream = Stream.unfoldChunkEffect(undefined, () => stepEffect);
const program = stream.pipe(
Stream.runDrain,
Effect.tapErrorCause((c) => Console.log("OUTSIDE tapErrorCause:", Cause.pretty(c)))
);
NodeRuntime.runMain(program);import { NodeRuntime } from "@effect/platform-node";
import { Cause, Chunk, Console, Effect, Option, Stream } from "effect";
const stepEffect = Effect.gen(function* () {
yield* Effect.fork(Effect.sleep("10 seconds")); // dom
yield* Effect.fork(
Effect.sleep("1 second").pipe(Effect.flatMap(() => Effect.fail("💥 screenshot failed"))) // shot
);
return Option.some([Chunk.empty(), undefined] as const);
}).pipe(Effect.tapErrorCause((c) => Console.log("INSIDE step tapErrorCause:", Cause.pretty(c))));
const stream = Stream.unfoldChunkEffect(undefined, () => stepEffect);
const program = stream.pipe(
Stream.runDrain,
Effect.tapErrorCause((c) => Console.log("OUTSIDE tapErrorCause:", Cause.pretty(c)))
);
NodeRuntime.runMain(program);