[Bug]: error messages and warnings should consistently go to stderr
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 442
- 派生
- 159
- 平均合并
- 7 天 21 小时
- 30 天内合并 PR
- 8
描述
### 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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 `linode-cli linodes create ... --json` 所执行的命令路径开始,重现一直到 `jq -r .[].id` 的管道流程。跟踪所显示的默认值警告在哪里输出,并验证成功的 JSON 保留在 stdout 上,而警告和错误发送到 stderr。完成的标准是管道在警告未污染其输入的情况下产生 `12345678`。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100