Skip to content
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

Duplex.from failure #40497

Closed
ronag opened this issue Oct 18, 2021 · 0 comments
Closed

Duplex.from failure #40497

ronag opened this issue Oct 18, 2021 · 0 comments
Labels
confirmed-bug Issues with confirmed bugs. stream Issues and PRs related to the stream subsystem.

Comments

@ronag
Copy link
Member

ronag commented Oct 18, 2021

  pipeline(
    Readable.from('abc\ndef\nghi'),
    Duplex.from(async function * (source) {
      let rest = ''
      for await (const chunk of source) {
        const lines = (rest + chunk.toString()).split('\n')
        rest = lines.pop()
        for (const line of lines) {
          yield line
        }
      }
      yield rest
    }),
    async function * (source) {
      let ret = ''
      for await (const x of source) {
        ret += x
      }
      assert.strictEqual(ret, 'abcdefghi')
    },
    common.mustCall(() => {}),
  )

Replace Duplex.from(arg) with arg and it works...

@ronag ronag added confirmed-bug Issues with confirmed bugs. stream Issues and PRs related to the stream subsystem. v16.x labels Oct 18, 2021
ronag added a commit to nxtedition/node that referenced this issue Oct 18, 2021
ronag added a commit to nxtedition/node that referenced this issue Oct 18, 2021
ronag added a commit to nxtedition/node that referenced this issue Oct 18, 2021
ronag added a commit to nxtedition/node that referenced this issue Oct 18, 2021
ronag added a commit to nxtedition/node that referenced this issue Oct 18, 2021
richardlau pushed a commit that referenced this issue Oct 19, 2021
Fixes: #40497

PR-URL: #40499
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
targos pushed a commit that referenced this issue Oct 20, 2021
Fixes: #40497

PR-URL: #40499
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant