Skip to content

test: stdin is not always a net.Socket - #5935

Merged
Fishrock123 merged 1 commit into
nodejs:masterfrom
Fishrock123:known-issue-stdin-not-net.socket
Mar 31, 2016
Merged

test: stdin is not always a net.Socket#5935
Fishrock123 merged 1 commit into
nodejs:masterfrom
Fishrock123:known-issue-stdin-not-net.socket

Conversation

@Fishrock123

Copy link
Copy Markdown
Contributor

Pull Request check-list

  • Does make -j8 test (UNIX) or vcbuild test nosign (Windows) pass with
    this change (including linting)?
  • Is the commit message formatted according to CONTRIBUTING.md?

Affected core subsystem(s)

test

Description of change

Refs: #5916 (comment)

<-ing a file into stdin actually results in a fs.ReadStream, rather an a tty.ReadStream, and as such does not inherit from net.Socket, unlike the other possible stdin options:

case'FILE':
varfs=require('fs');
stdin=newfs.ReadStream(null,{fd: fd,autoClose: false});
break;

cc @Trott I think this should cover the known issue.

@Fishrock123Fishrock123 added test Issues and PRs related to the tests. process Issues and PRs related to the process subsystem. labels Mar 28, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this comment up to line 2.

@cjihrig

Copy link
Copy Markdown
Contributor

LGTM with a couple comments.

@Fishrock123

Copy link
Copy Markdown
ContributorAuthor

Hmmm, doing this reliably in a must-fail environment is quite tricky.

@Fishrock123
Fishrock123force-pushed the known-issue-stdin-not-net.socket branch from f9486f0 to f384f83CompareMarch 30, 2016 17:36
@Fishrock123

Copy link
Copy Markdown
ContributorAuthor

CI on windows: https://ci.nodejs.org/job/node-test-known-issues/2/ (That ci says to not run with all?)

@Fishrock123

Copy link
Copy Markdown
ContributorAuthor

@cjihrig LGTY now?

@cjihrig

Copy link
Copy Markdown
Contributor

Yea, LGTM

`<`-ing a file into stdin actually results in a `fs.ReadStream`, rather
than a `tty.ReadStream`, and as such does not inherit from net.Socket,
unlike the other possible stdin options.
Refs: nodejs#5916
PR-URL: nodejs#5935
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@Fishrock123
Fishrock123force-pushed the known-issue-stdin-not-net.socket branch from f384f83 to d6c9f64CompareMarch 31, 2016 18:11
@Fishrock123
Fishrock123 merged commit d6c9f64 into nodejs:masterMar 31, 2016
@cjihrig

Copy link
Copy Markdown
Contributor

@Fishrock123 is there a particular issue on the issue tracker that this maps to? I noticed you Refs'ed a PR. I've been adding the repro-exists label to the referenced issues, but I'm not not if that would apply to a PR.

@phillipj

Copy link
Copy Markdown
Member

@Fishrock123 did this pass linting for you? I'm getting this locally:

➜ make lint
./node tools/eslint/bin/eslint.js benchmark lib src test tools/doc \
tools/eslint-rules --rulesdir tools/eslint-rules
/Users/phillipj/node/test/known_issues/test-stdin-is-always-net.socket.js
14:1 error Line 14 exceeds the maximum line length of 80 max-len
✖ 1 problem (1 error, 0 warnings)

@thefourtheye

Copy link
Copy Markdown
Contributor

#5980 Fixes the linter error

thefourtheye added a commit to thefourtheye/io.js that referenced this pull request Mar 31, 2016
Refer: nodejs#5935
PR-URL: nodejs#5980
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
thefourtheye added a commit that referenced this pull request Mar 31, 2016
Refer: #5935
PR-URL: #5980
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Phillip Johnsen <johphi@gmail.com>
@jasnell

Copy link
Copy Markdown
Member

Is this applicable to v4?

@Fishrock123

Copy link
Copy Markdown
ContributorAuthor

@jasnell do we put known-issue tests there? if so, yes this applies back as far as I can remember.

@jasnell

Copy link
Copy Markdown
Member

Yep, we can port the known-issue tests back to v4 now

MylesBorins pushed a commit that referenced this pull request Apr 5, 2016
`<`-ing a file into stdin actually results in a `fs.ReadStream`, rather
than a `tty.ReadStream`, and as such does not inherit from net.Socket,
unlike the other possible stdin options.
Refs: #5916
PR-URL: #5935
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Apr 5, 2016
Refer: #5935
PR-URL: #5980
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Phillip Johnsen <johphi@gmail.com>
This was referenced Apr 5, 2016
MylesBorins pushed a commit that referenced this pull request Apr 11, 2016
`<`-ing a file into stdin actually results in a `fs.ReadStream`, rather
than a `tty.ReadStream`, and as such does not inherit from net.Socket,
unlike the other possible stdin options.
Refs: #5916
PR-URL: #5935
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Apr 11, 2016
Refer: #5935
PR-URL: #5980
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Phillip Johnsen <johphi@gmail.com>
@MylesBorinsMylesBorins mentioned this pull request Apr 11, 2016
@addaleaxaddaleax added the known limitation Issues that are identified as known limitations. label May 18, 2018
@addaleax

Copy link
Copy Markdown
Member

@Fishrock123 I know this was a long, long time ago, but what exactly is the issue that this test is catching? It sounds like the underlying idea is that stdio streams should always inherit from net.Socket, but that isn’t really made explicit anywhere, is it?

@Fishrock123

Fishrock123 commented May 18, 2018

Copy link
Copy Markdown
ContributorAuthor

@addaleax There was this thing at one point where sometimes stdin wasnt a net.Socket... I think this checks when stdin doesn't actually exist that it still makes a socket?

It was supposed to be a consistency check.


Edit:

It sounds like the underlying idea is that stdio streams should always inherit from net.Socket

Yes.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

known limitationIssues that are identified as known limitations.processIssues and PRs related to the process subsystem.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@Fishrock123@cjihrig@phillipj@thefourtheye@jasnell@addaleax@mscdex@MylesBorins