-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
test: add hijackStdout and hijackStderr #13439
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
Changes from 1 commit
82dd2c2
d261893
bda1fd1
5a3a666
ab93f52
2a42456
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -764,12 +764,12 @@ exports.getTTYfd = function getTTYfd() { | |
| const stdWrite = {}; | ||
| function hijackStdWritable(name, listener) { | ||
| const stream = process[name]; | ||
| const _write = stdWrite[name] = stream.write.bind(stream); | ||
| const _write = stdWrite[name] = stream.write; | ||
|
|
||
| stream.writeTimes = 0; | ||
| stream.write = function(data, callback) { | ||
| listener(data); | ||
| _write(data, callback); | ||
| _write.call(stream, data, callback); | ||
| stream.writeTimes++; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic seem not go well with the writable.write specification:
Your logic will cause:
I propose:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👌
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact, And I've added the |
||
| }; | ||
| } | ||
|
|
||
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.
These should be listed as separate functions (even if it means duplicating the text)
Uh oh!
There was an error while loading. Please reload this page.
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.
@jasnell I suggested the the merge (since it's an internal guide) #13439 (comment)
Please 👍 / 👎 again, just so we don't ask @XadillaX to do unnecessary work
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'd rather keep the style consistent throughout, so would really prefer them separate.
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.
Ack.
Sorry @XadillaX
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.
👌