Skip to content

--version prints newline to stderr #131

Closed

Description

@ehandal

This is a bit weird, not sure if intentional:

~ $ hexyl --version
hexyl 0.8.0
~ $ hexyl --version > /dev/null

~ $ hexyl --version &> /dev/null
~ $

Activity

  1. sharkdp commented on Mar 27, 2021

    @sharkdp
    Owner

    That is not intended, no. Thanks for reporting.

  2. added
    bug
    good first issue
    on Mar 27, 2021
  3. scimas commented on Apr 23, 2021

    @scimas
    Contributor

    There isn't any newline in the version output. See clap-rs/clap#1960, clap-rs/clap#1972 which will actually (correctly) add new lines to the version output.

    The reason hexyl is getting a newline on stderr is this:
    clap prints version for hexyl without the trailing newline (the PR I linked above isn't included in the clap version hexyl is built with). But then the eprint! in hexyl main calls the error formatting in clap which does a writeln! and so you get the newline in stderr.

    For some reason the --help output is directed to stderr rather than stdout, so the issue isn't visible there.

  4. added a commit that references this issue on Apr 6, 2025
    532eab7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions