[Bug]: error messages and warnings should consistently go to stderr

Open
#643 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
cli

Research direction

Start with the linode-cli command path exercised by linode-cli linodes create ... --json, reproducing the pipeline through jq -r .[].id. Trace where the shown default-values warning is emitted and verify that successful JSON remains on stdout while warnings and errors go to stderr. Done means the pipeline produces 12345678 without the warning contaminating its input.

Written by the indexing model from the issue text.

Description

bug
CLI Version

linode-cli v5.51.0 Built from spec version 4.176.0

Command

linode-cli linodes create [...args...] --json | jq -r .[].id

Output

parse error: Invalid numeric literal at line 1, column 6

Expected Behavior

12345678

Actual Behavior

The problem occurs because linode-cli prints warnings and error messages to stdout. In this case, the (successful) command prints

Using default values: {'authorized_users': ['jschauma']}; use the --no-defaults flag to disable defaults

to stdout before printing the json output. This then leads to tools not being able to consume the output as expected.

The correct behavior here is to send all error messages and warnings to stderr, like a good little Unix tool.

Steps to Reproduce

linode-cli linodes create [...args that produce a warning...] --json | jq -r .[].id

Dominant language
Python
Stars
442
Forks
159
Avg merge
7d 21h
Merged PRs (30d)
8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from linode/linode-cli

All issues in linode/linode-cli

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.