Giter Club home page Giter Club logo

Comments (8)

Sequoia avatar Sequoia commented on August 15, 2024 3

the confusion here stems from the following:

  • process.stdin: 📖 Readable stream
  • process.stdout: 📝 Writable stream
  • childProc.stdin: 📝 Writable stream
  • childProc.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.

lyzadanger avatar lyzadanger commented on August 15, 2024 1

+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.

Ryan1729 avatar Ryan1729 commented on August 15, 2024

I also found myself confused as to why

return duplexer(childProcess.stdout, childProcess.stdin);

didn't work.

from stream-adventure.

famousgarkin avatar famousgarkin commented on August 15, 2024

+1

from stream-adventure.

klarkc avatar klarkc commented on August 15, 2024

+1 The @Sequoia explanation must be in the documentation.

from stream-adventure.

mganuci avatar mganuci commented on August 15, 2024

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.

kalinchernev avatar kalinchernev commented on August 15, 2024

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.

ccarruitero avatar ccarruitero commented on August 15, 2024

Closing since changes was added in #196

from stream-adventure.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.