Skip to content

Strange behaviours of slurping streaming input without line terminators at the end #3273

@itchyny

Description

@itchyny

Describe the bug
When the input steam has no line terminator (and space) at the end, the combination of --slurp and --stream flags behaves oddly.

To Reproduce

 $ printf "[1]\n" | jq -c -s --stream .
[[[0],1],[[0]]] # ok

 $ printf "[1]" | jq -c -s --stream .  
[[[0],1]]
[[0]] # unexpected

Expected behavior
The second command outputs as same as the first command.

Environment (please complete the following information):

  • OS and Version: not related
  • jq version: 1.7.1 (and 1.7, 1.6)

Additional context
This is a close issue of #1534 but with the streaming parser flag.

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