Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TypeError: dest.on is not a function when using .pipe #904

@dansamsara

Description

@dansamsara

This bug appears to have been introduced in 8.1.7. Reverting to 8.1.6 fixes the issue.

Expected Behavior

import "zx/globals"; // @8.1.7
$`ls`.pipe(process.stdout);

This should print out the list of files in the current directory.

Actual Behavior

zx --install ls_pipe_test.mjs
node:internal/streams/readable:933
  dest.on('unpipe', onunpipe);
       ^

TypeError: dest.on is not a function
    at Readable.pipe (node:internal/streams/readable:933:8)
    at _ProcessPromise._postrun (/home/ubuntu/Downloads/node_modules/zx/build/core.cjs:366:41)
    at _ProcessPromise.run (/home/ubuntu/Downloads/node_modules/zx/build/core.cjs:275:10)
    at Immediate.callback (/home/ubuntu/Downloads/node_modules/zx/build/core.cjs:126:58)
    at process.processImmediate (node:internal/timers:483:21)
    at process.callbackTrampoline (node:internal/async_hooks:130:17)

Node.js v20.17.0

Steps to Reproduce

  1. Create a file with the JS documented in Expected Behavior above.
  2. Run the file like this: zx --install test_file_name.mjs

Specifications

  • zx version: 1.8.7
  • Platform: linux
  • Runtime: node 20.17

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions