-
-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add .all
property with interleaved stdout and stderr
#171
Merged
Merged
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6c46865
Added result.all intermixed stdout/stderr (concat for sync)
tomsotte 4069b17
Removed `all` stream from execa.sync(); fix creating mixed stream for…
tomsotte 97cde71
Added `all` stream documentation and why it's not possible in execa.s…
tomsotte 23799a0
More predictable noop-132 fixture for testing `all` stream output
tomsotte 40aa251
Merge with upstream/master; fix rename `m` -> `execa` in test.js
tomsotte 3832328
Merge branch 'master' into iss1
tomsotte e35dcdf
Fixed trailing space
tomsotte 7f430d9
Using test.serial for testing result.all with lower timeout for noop-…
tomsotte b500215
Added execa.all(), similar to execa.stdout() for result.all; added test
tomsotte a419b4a
Fixed link to Node.js docs about process I/O stream
tomsotte bc1450a
all available on errors, if available in result (ex. no execa.sync())
tomsotte 29f3f12
Added all interleaved stream to readme in Why, example and API
tomsotte 43a43bd
Removed unnecessary comments on noop-132 and test.js
tomsotte dc68492
Fixed and improved readme about all interleaved stream
tomsotte 360bdb4
Removed execa.all()
tomsotte 06fbfff
Update readme.md
sindresorhus e128464
Update readme.md
sindresorhus e842c72
Merge branch 'master' into iss1
sindresorhus b815a79
Update readme.md
sindresorhus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
// Interleaving the output of stdout and stderr is unpredictable and can't be | ||
// expressed as a test. What I've tried so far to make it predictable: | ||
// - process.stdout._handle.setBlocking(true) | ||
// - process.stdout.once('drain', () => process.stderr.write('2')); | ||
// - process.stdout.write('1', () => process.stderr.write('2')); | ||
// - await delay() between calls; it works but with varying ms, based on load | ||
ehmicky marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// - console.log/error | ||
tomsotte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
process.stdout.write('1'); | ||
process.stderr.write('3'); | ||
|
||
setTimeout(() => { | ||
process.stdout.write('2'); | ||
}, 1000); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not test interleaving because
stderr
is not in-between twostdout
calls.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was my mistake, I should have left it in-between and let the test fail. As I said in the comments I was testing various way to implement the test to be correct but I couldn't find one for all (more on this on the next conversation).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I think it might be a good idea to do a more complex interleaving like stdout > stderr > stderr > stdout > stderr > stdout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it needs to be more complex, if it works just once we should expect to interleave the rest of the outputs. Otherwise we know it's just concatenating the output strings.
From what I understand by the tests I'm doing is that we cannot guarantee the order of the interleaving.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think @sindresorhus?