IntersectMBO / IntersectMBO/ouroboros-network

Cardano-ping output incorrect JSON when it fails to connect

Open
#5,137 2 comments 0 reactions 0 assignees View on GitHub
cardano-ping
Dominant language
Haskell
Stars
296
Forks
104
Avg merge
2d 10h
Merged PRs (30d)
4

Description

As discussed in this [cardano-cli issue](https://github.com/IntersectMBO/cardano-cli/issues/1210), the `cardano-cli ping` command only outputs `] }` when it fails to run with `-j` flag.
It seems the issue comes from [this code](https://github.com/input-output-hk/ouroboros-network/blob/8d9a99fe88c96446586af47abd0ca59fb63d1b80/cardano-ping/src/Cardano/Network/Ping.hs#L114), when there's no `LogMsg` emitted and only a `LogEnd` received.

It seems to me it would be more robust to:
1. provide more "domain specific" logging messages containing the needed information
2. output one JSON object per `LogMsg` per line

I am happy to provide a patch for this but not sure if I am not missing something?

In any case, it would be great if we could avoid outputting those spurious endings.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.