fix: reject instead of throwing when there's an error before reading stdin - #45
Merged
Conversation
43081j
reviewed
Jul 25, 2026
43081j
reviewed
Jul 25, 2026
This basically splits the test in two: 1. Spawn a real process which has non-zero exit 1a. This used to be an actual on-file disk but doesn't need to be. It can be a `node -e` process. 1b. It no longer needs to exclude win32 since it is just regular logic that'll run on all platforms 2. Mock a process that has a zero exit but its stdin throws 2a. For this one, we don't actually spawn a child, we just reject via the `on` handler This puts the test in alignment with all existing tests (it wasn't before, as the only test writing real files and spawning on-disk scripts).
Member
|
FYI i've rewritten the test slightly so it works like the other ones. As part of that, I also added a 2nd test. the first test, having a non-zero exit, would always hit this: if (code !== 0) {
return reject(createUnknownError(command, code, stderr));
}which meant we had no test covering this (from a writeError ? reject(writeError) : resolve();now the first test is non-zero so rejects with the unknown error, and the second test has a zero exit code so hits the |
43081j
approved these changes
Jul 27, 2026
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.
encountered this issue in
@nuxt/clicopying the dev server URL on a headless Linux box (ourxclipwas a shim that exits 1 immediately on -i, but any environment wherexclip/wl-copy/xselfails to start will do it).(it emitted a
UNCAUGHT: write EPIPEerror)this simply attaches a listener for errors to make it a bit more stable 🙏