fix: Add maxBuffer option and enforce MAX_STRING_LENGTH on stdout and stderr by default [EXP-02]#55
Merged
Merged
Conversation
- Unset means we enforce this limit lazily - Set means we enforce it eagerly - Delay buffer concat until evaluation time
Merged
3 tasks
kitten
added a commit
to expo/expo
that referenced
this pull request
May 18, 2026
…wn-async` [EXP-60] (#45891) ## Summary Related to / Overlaps with #45836 The use of `shell` for Windows is easily externally controllable, and that's an unnecessary risk, which `@expo/spawn-async` mitigates. This will also mean it benefits from other fixes, e.g. expo/spawn-async#55, or existing mitigations. # Checklist <!-- Please check the appropriate items below if they apply to your diff. --> - [x] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
byCedric
approved these changes
May 19, 2026
ide
reviewed
May 19, 2026
kitten
added a commit
that referenced
this pull request
May 19, 2026
Co-authored-by: James Ide <ide@expo.dev>
Member
Author
|
Checking against |
3 tasks
kitten
added a commit
to expo/expo
that referenced
this pull request
May 19, 2026
## Summary See: expo/spawn-async#55 ## Checklist <!-- Please check the appropriate items below if they apply to your diff. --> - [x] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
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
Note
This attempts to avoid breaking changes, and is hand-written, since it's a thin line to walk, that didn't lead LLMs to write clean code. It's still LLM reviewed though
The string captured for
stdoutandstderrimplicitly stringifies chunks, which can crash the process in two ways:By default, we should be enforcing the
MAX_STRING_LENGTH. Existing calls ofspawnAsyncwill now enforce this limit and will issue an error with the truncated strings when this limit is exceeded. Thestdoutandstderrstrings are built lazily. The error we throw for this case will carry the truncated outputs.When
maxBufferis set explicitly, we enforce this limit explicitly and reject thespawnAsyncpromise explicitly.This was done to limit disruption to downstream consumers. However, it's still necessary for us to update call-sites that are uncontrolled/unbounded with an explicit
maxBuffer, if we're callingspawnAsyncon any process that:Set of changes
maxBufferoption that, if set, rejects with acode: 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER'error when the buffer size is exceededstdoutandstderrchunksstdoutandstderrgetters that build the output stringmaxBufferis not set explicitly, they may error lazily when the maximum size is reached now, which would've previously resulted in the max string length being exceeded accidentally during concatenationcompletionListenernot being attached toexitwhenstdiois ignored andignoreStdioisn'ttrue