ouroboros-network icon indicating copy to clipboard operation
ouroboros-network copied to clipboard

Cardano-ping output incorrect JSON when it fails to connect

Open abailly opened this issue 7 months ago • 2 comments

As discussed in this cardano-cli issue, the cardano-cli ping command only outputs ] } when it fails to run with -j flag. It seems the issue comes from this code, 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.

abailly avatar Jun 05 '25 05:06 abailly

@karknu WDYT?

abailly avatar Jun 05 '25 05:06 abailly

I agree that this should be fixed so that cardano-ping spits out valid json even when it fails to connect. Please create a PR.

karknu avatar Jun 05 '25 08:06 karknu