Skip to content

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

Description

@floriangeorgi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions