Comments (8)
the confusion here stems from the following:
process.stdin
: 📖 Readable streamprocess.stdout
: 📝 Writable streamchildProc.stdin
: 📝 Writable streamchildProc.stdout
: 📖 Readable stream
for process you're inside the process to stdin
is readable to you, for child process you're outside so that process's stdin
is writable to you.
from stream-adventure.
+1 on this. The confusing element for me here isn't duplexer
's argument order necessarily (which are explicitly mentioned in the instructions), but that child_process.stdin
is a Writeable stream (as opposed to process.stdin
, which is a Readable stream) and child_process.stdout
which is likewise flipped from process.stdout
. So I struggled for a while with
return duplexer(childProcess.stdout, childProcess.stdin);
Because I didn't realize that child_process
flipped the stdin/stdout
stream types (not because I didn't grok that the Writeable
should come first).
At the very least perhaps a heads up to this little twist in child_process
?
from stream-adventure.
I also found myself confused as to why
return duplexer(childProcess.stdout, childProcess.stdin);
didn't work.
from stream-adventure.
+1
from stream-adventure.
+1 The @Sequoia explanation must be in the documentation.
from stream-adventure.
Thank you @Sequoia for the explanation, I got confused as well. However, even the reference solution doesn't work due to a unit test failing
not ok 3 should be equal
---
operator: equal
expected:
'ihrl\nibza\nipzjbpa\nillasl\nillasl\nihghhy\nivvw\nillw\nillw\nibza\nibn\
nilla\nifghuapul\nive'
actual:
'ihrl\nibza'
...
from stream-adventure.
Nice discussion, definitely worth having the explanation from @Sequoia in the exercise to be accessible to anyone going through the problem. Opened a PR to include these additions in the hints.
from stream-adventure.
Closing since changes was added in #196
from stream-adventure.
Related Issues (20)
- update html_stream exercise HOT 2
- add exercise about implement a writable stream
- add problem to use async generators and iterators
- add/update problem to use stream pipeline
- add problem about stream object mode HOT 1
- duplexer-redux uses [object Object] HOT 1
- Read_IT instructions need reviewed HOT 4
- Why does this need to be a duplex HOT 1
- "Read It" problem lacks clear instructions HOT 1
- data fed to stdin for the "lines" problem has no new lines in it, please fix
- Some text will not show in Windows 10 with Git Bash HOT 1
- cosmetic: IMHO we should adjust some texts HOT 2
- (almost) npm free solutions HOT 2
- Cannot finish the Lesson 7 HOT 2
- ENOTCONN error in combiner
- combiner challenge - ERR_STREAM_CANNOT_PIPE (not readable) HOT 1
- Secretz seems broken HOT 2
- Unable to complete Lesson 7 HOT 4
- TypeError while running Exercise 13 (DUPLEXER) and 14 (DUPLEXER REDUX) HOT 1
- Write-to-me: Instructions vague
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stream-adventure.