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

.lines() function outputs array with an empty string instead of the actual output #911

Closed
floriangeorgi opened this issue Sep 25, 2024 · 1 comment · Fixed by webpod/zurk#16 or #912
Labels

Comments

@floriangeorgi
Copy link

floriangeorgi commented Sep 25, 2024

Expected Behavior

#!/usr/bin/env zx
import {$} from 'zx'
console.log($.sync`echo -e "Item1\nItem2\nItem3"`.lines());

This code should output: [ 'Item1', 'Item2', 'Item3' ]
This is at least the behavior in version 8.1.4.

Actual Behavior

It outputs an array with an empty string: [ '' ]

Steps to Reproduce

  1. Create a new node project, install zx and add index.mjs.
// index.mjs

#!/usr/bin/env zx
import {$} from 'zx'
console.log($.sync`echo -e "Item1\nItem2\nItem3"`.lines());
  1. Make it executable. chmod +x index.mjs
  2. Run it with zx index.mjs

Specifications

  • zx version: 8.1.8
  • Platform: windows / macos / linux
  • Runtime: node / deno / bun
@antongolub
Copy link
Collaborator

@floriangeorgi,

Thanks for the report. The fix is on the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants