diff --git a/.changeset/tidy-pandas-report.md b/.changeset/tidy-pandas-report.md new file mode 100644 index 0000000..805d38b --- /dev/null +++ b/.changeset/tidy-pandas-report.md @@ -0,0 +1,5 @@ +--- +"t3code-cli": patch +--- + +report unexpected runtime defects instead of exiting silently diff --git a/src/bin.ts b/src/bin.ts index 467d45e..b2e9b2b 100755 --- a/src/bin.ts +++ b/src/bin.ts @@ -54,14 +54,17 @@ const program = Effect.gen(function* () { process.exitCode = error.errors.length > 0 ? 1 : 0; }), ), - Effect.tapError((error) => - Effect.gen(function* () { - const output = yield* T3Output; - yield* output.writeStderr(`${error instanceof Error ? error.message : String(error)}\n`); - }), - ), + Effect.matchEffect({ + onFailure: (error) => + Effect.gen(function* () { + const output = yield* T3Output; + yield* output.writeStderr(`${error instanceof Error ? error.message : String(error)}\n`); + process.exitCode = 1; + }), + onSuccess: (value) => Effect.succeed(value), + }), Effect.scoped, Effect.provide(CliLayer), ); -NodeRuntime.runMain(program, { disableErrorReporting: true }); +NodeRuntime.runMain(program);