Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
test: skip whether TTY is availble#13991
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
trevnorris commented Jun 29, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
addaleax left a comment
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.
LGTM, but at some point I’d like it if we could split up the async_hooks test directory and move these to the pseudo-tty tests
trevnorris commented Jul 3, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
refack commented Jul 3, 2017
New code works here (on Windows), but I see you have problems in linux https://ci.nodejs.org/job/node-test-commit-linuxone/7060/nodes=rhel72-s390x/console |
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 i'm not in love with... does require('tty') have significant side effects?
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.
Hm. Reason I return null here then check it below is because I'd have imagined that common.getTTYfd() should only return a positive number if there's a valid fd for the TTY. Thus ReadStream/WriteStream shouldn't fail. Appears that isn't always the case. So I'll go back to the null check and early return.
I will defend the use of getTTYfd(), which also does a require('tty') when called. So I'm not worried about the possible side effects of calling it here.
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.
So if we don't fear side effect, why not move the require to the top?
The invoked lambda I understand (return null and assign to const is very functional-programing, and I like 👍 )
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.
Ohh here it is again.
refack commented Jul 3, 2017
Is it easy to parameterize and merge these two? |
trevnorris commented Jul 5, 2017
Probably. If not in this PR I'll add another that merges them later. |
trevnorris commented Jul 6, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@refack Don't know why I didn't think of the fact that |
If TTY isn't available then the test will always fail. Also use the already available process.stdin instead of opening another ReadStream. Fixes: nodejs#13984 PR-URL: nodejs#13991
Match changes made to test-ttywrap.readstream for consistency. PR-URL: nodejs#13991
refack left a comment
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.
K.I.S.S. FTW!
AndreasMadsen commented Jul 10, 2017
Anything preventing this from landing? |
refack commented Jul 10, 2017
I believe just etiquette, to customarily let Collaborators land their own PRs 🤷♂️ |
AndreasMadsen commented Jul 10, 2017
That is why I asked :) |
jasnell commented Jul 12, 2017
Yes and no. Anyone should feel free to land any PR that is ready to land, particularly ones that are more or less trivial. For PRs that are more involved, then yes, it's best to let the authoring contributor land as they have the best context to know when it's ready to go. |
If TTY isn't available then the test will always fail. Also use the already available process.stdin instead of opening another ReadStream. PR-URL: nodejs#13991Fixes: nodejs#13984 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
Match changes made to test-ttywrap.readstream for consistency. PR-URL: nodejs#13991Fixes: nodejs#13984 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
refack commented Jul 12, 2017
Since @trevnorris is busy with another PR, and I'm pretty aware of the context: |
trevnorris commented Jul 12, 2017
@refack Thanks for landing this. |
If TTY isn't available then the test will always fail. Also use the already available process.stdin instead of opening another ReadStream. PR-URL: #13991Fixes: #13984 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
Match changes made to test-ttywrap.readstream for consistency. PR-URL: #13991Fixes: #13984 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
If TTY isn't available then the test will always fail. Also use the already available process.stdin instead of opening another ReadStream. PR-URL: #13991Fixes: #13984 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
Match changes made to test-ttywrap.readstream for consistency. PR-URL: #13991Fixes: #13984 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test
Description
If TTY isn't available then the test will always fail.
Fixes: #13984
CI: https://ci.nodejs.org/job/node-test-pull-request/8879/