Repository navigation
Expose stderr terminal state through Stdio - #8686
Open
ChrisPrapas wants to merge 2 commits into
Open
ChrisPrapas wants to merge 2 commits into
ChrisPrapas wants to merge 2 commits into
Conversation
Expose whether standard error is a terminal next to stdinIsTerminal and stdoutIsTerminal. make and layerTest default it to false; the Node and Deno layers read the real stream state each time the effect runs. Bun and Node pick it up through node-shared. Closes Effect-TS#8639 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 6137f50 The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
ChrisPrapas
marked this pull request as ready for review
October 5, 2026 08:21
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
stderrIsTerminaltoStdio, next tostdinIsTerminalandstdoutIsTerminal, following #7090. A program that reuses stdout's answer for stderr gets it wrong for cases liketool | less(stdout piped, stderr a terminal) andtool 2>log.txt(stderr redirected, stdout a terminal).This PR was prepared with the help of an AI assistant (Claude Code).
Changes
Stdiointerface gainsstderrIsTerminal: Effect.Effect<boolean>.makeandlayerTestdefault it tofalse, like the other two.NodeStdio):process.stderr.isTTY === true, read each time the effect runs. Bun and Node pick it up throughnode-shared.DenoStdio):Deno.stderr.isTerminal(), read each time the effect runs.Stdio,NodeStdioandDenoStdiotests are extended so stderr differs from stdout in each case, so a crossed wire fails.effect,@effect/platform-node-sharedand@effect/platform-deno.Compatibility
Like #7090, this adds a required member to the
Stdiointerface. Callers that usemakeorlayerTestare unaffected. Hand-builtStdioobject literals need the new field.Assumption
I assumed stderr was not left out on purpose. Happy to close this if it was.
Testing
Run with
npx -y pnpm@11.20.0:pnpm test --run packages/effect/test/Stdio.test.ts packages/platform/node-shared/test/NodeStdio.test.ts packages/platform/deno/test/DenoStdio.test.ts: 2 files passed, 3 tests passed. The Deno test file was skipped under Node.Not run by me before opening this draft (stated plainly so reviewers do not assume otherwise):
pnpm check,pnpm lint,pnpm circular,pnpm jsdocs --check,pnpm ai-docgen, and the Deno runtime tests anddeno check. The Deno changes are therefore untested under Deno. I'll rely on CI for the rest.Closes #8639
🤖 Generated with Claude Code