Skip to content

[Feature]: Error output should be be written to stderr #1851

@jennings

Description

@jennings

Description

I use CSharpier as a jj fix tool, which means the current file is piped to CSharpier over stdin and the formatted result read from stdout.

If a file is malformed XML, CSharpier writes the following to stdout and CSharpier exits with code 0, causing jj to replace the entire file contents with this warning:

Warning <path> - Appeared to be invalid xml so was not formatted.

I'm happy to submit a PR to change this, I just want to make sure which of these cases would be welcome changes:

  • (Required for my use case) Exit with a non-zero exit code. I would just pick code 1 unless you want a different value (I don't think the CLI has a convention for this yet?)
  • (Optional but I strongly recommend) Print errors and warnings to stderr, not stdout.
  • (Not required for my particular use case, but I noticed this while testing this changed behavior) Write the "Formatted N files in Xms." message to stderr as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions