Skip to content

Make ksdump output only JSON on success #56

Closed
@wader

Description

@wader

Hi, i think ksdump -f json would be easier to use with jq etc and be more what i would expect if only outputted JSON on stdout. Currently it also outputs some log messages on stdout making the output invalid JSON. Maybe on error it could print logs on stderr?

Reproduction:

$ docker run -v "$PWD:/share" -it --entrypoint=ksdump kaitai/ksv -f json /dev/zero some.ksy
Compilation OK
... processing substring_diff.ksy 0
...... loading substring_diff.rb
Classes loaded OK, main class = SubstringDiff
{
  "a": ""
}

Workaround i use at the moment is to pipe thru tail ksdump ... | tail +5 | jq ....

If good ide I guess same would apply for XML and YAML output.

I also noticed that there is no trailing new line for the last JSON output line, making it a bit awkward in a shell.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions