<#20462 `pants peek` outputs 2 arrays instead of o...
# github-notifications
c
#20462 `pants peek` outputs 2 arrays instead of one Issue created by grihabor Describe the bug At some point
pants peek
decides to end the array and start the new one:
Copy code
$ pants list :: | xargs pants peek  | head -n 70255 | tail
    ],
    "tags": null
  }
]
[
  {
    "address": "weatherfx/files/overlay/lga/BUILD:conf",
    "target_type": "file",
    "dependencies": [],
    "dependencies_raw": null,
$ pants list :: | xargs pants peek | yq -p json length
2445
36
Pants version pants_version = "2.19.0rc2" OS Ubuntu 22.04 Additional info We're parsing pants peek output in python:
Copy code
# pants peek | python run.py
targets = json.load(sys.stdin)
So starting a new array at the middle of the output breaks this code. Suggested fix: add the
[peek].json_lines
flag that will write a json representation of a target per line, so that people could do this:
Copy code
# pants peek | python run.py
for line in sys.stdin:
    target = json.loads(line)
pantsbuild/pants