OpenAPITools / OpenAPITools/openapi-generator-cli
[BUG] tool assumes a tty and does not work correctly with a pipeline or stdout redirection
@kay-schecker がすでに取り組んでいます。
2022年11月29日 から。
- 主要言語
- TypeScript
- スター
- 2k
- フォーク
- 208
- 平均マージ
- 7時間 12分
- マージ済み PR(30日)
- 6
説明
🐛 Bug Report:
Describe the bug
The tool appears to assume it is used in a TTY/console and does not work when redirecting stdout/stdout
Specifically:
openapi-generator-cli version-manager list
emits the following in a console:
? The following releases are available: (Use arrow keys)
☐ releasedAt version installed versionTags
- ---------- ----------- --------- ----------------------------
❯ ☐ 2022-11-01 6.2.1 yes 6.2.1 stable latest
☐ 2022-09-24 6.2.0 no 6.2.0 stable
☐ 2022-09-11 6.1.0 no 6.1.0 stable
☐ 2022-07-03 6.0.1 no 6.0.1 stable
☐ 2022-05-26 6.0.0 no 6.0.0 stable
☐ 2022-04-04 6.0.0-beta no 6.0.0-beta 6.0.0 beta beta
☒ 2022-01-31 5.4.0 yes 5.4.0 stable
☐ 2021-12-21 5.3.1 no 5.3.1 stable
☐ 2021-10-24 5.3.0 no 5.3.0 stable
☐ 2021-08-16 5.2.1 no 5.2.1 stable
☐ 2021-07-09 5.2.0 no 5.2.0 stable
☐ 2021-05-07 5.1.1 no 5.1.1 stable
☐ 2021-03-20 5.1.0 no 5.1.0 stable
☐ 2021-02-06 5.0.1 no 5.0.1 stable
☐ 2020-12-21 5.0.0 no 5.0.0 stable
☐ 2020-11-20 5.0.0-beta3 no 5.0.0-beta3 5.0.0 beta3 beta
☐ 2020-09-04 5.0.0-beta2 no 5.0.0-beta2 5.0.0 beta2 beta
☐ 2020-06-29 5.0.0-beta no 5.0.0-beta 5.0.0 beta beta
☐ 2020-05-06 4.3.1 no 4.3.1 stable
☐ 2020-03-27 4.3.0 no 4.3.0 stable
☐ 2020-01-31 4.2.3 no 4.2.3 stable
☐ 2019-12-02 4.2.2 no 4.2.2 stable
☐ 2019-11-15 4.2.1 no 4.2.1 stable
☐ 2019-10-31 4.2.0 no 4.2.0 stable
☐ 2019-10-04 4.1.3 no 4.1.3 stable
☐ 2019-09-11 4.1.2 no 4.1.2 stable
☐ 2019-08-26 4.1.1 no 4.1.1 stable
☐ 2019-08-09 4.1.0 no 4.1.0 stable
☐ 2019-07-09 4.0.3 no 4.0.3 stable
☐ 2019-06-20 4.0.2 no 4.0.2 stable
☐ 2019-05-31 4.0.1 no 4.0.1 stable
☐ 2019-05-13 4.0.0 no 4.0.0 stable
☐ 2019-04-04 4.0.0-beta3 no 4.0.0-beta3 4.0.0 beta3 beta
☐ 2019-01-31 4.0.0-beta2 no 4.0.0-beta2 4.0.0 beta2 beta
☐ 2018-12-31 4.0.0-beta no 4.0.0-beta 4.0.0 beta beta
☐ 2018-11-30 3.3.4 no 3.3.4 stable
☐ 2018-11-15 3.3.3 no 3.3.3 stable
☐ 2018-10-31 3.3.2 no 3.3.2 stable
☐ 2018-10-15 3.3.1 no 3.3.1 stable
☐ 2018-10-01 3.3.0 no 3.3.0 stable
☐ 2018-08-30 3.2.3 no 3.2.3 stable
☐ 2018-08-22 3.2.2 no 3.2.2 stable
☐ 2018-08-14 3.2.1 no 3.2.1 stable
☐ 2018-08-06 3.2.0 no 3.2.0 stable
☐ 2018-07-25 3.1.2 no 3.1.2 stable
☐ 2018-07-18 3.1.1 no 3.1.1 stable
☐ 2018-07-06 3.1.0 no 3.1.0 stable
☐ 2018-06-27 3.0.3 no 3.0.3 stable
☐ 2018-06-18 3.0.2 no 3.0.2 stable
☐ 2018-06-11 3.0.1 no 3.0.1 stable
☐ 2018-06-01 3.0.0 no 3.0.0 stable
- ---------- ----------- --------- ----------------------------
however, if you run this and redirect the output (or try to pipe it into another process, like grep),
the output is truncated and appears to be prompting a console to use arrow keys to prompt for selection
$ openapi-generator-cli version-manager list | grep yes
this hangs.
Redirect:
$ openapi-generator-cli version-manager list >| /tmp/list.txt
also hangs.
Pipe stdin from /dev/null :
$ openapi-generator-cli version-manager list < /dev/null >| /tmp/list.txt
shows the program is expecting input, and it also does not list all versions
before it detects an EOF on input and aborts prematurely:
$ cat /tmp/list.txt
? The following releases are available: (Use arrow keys)
☐ releasedAt version installed versionTags
- ---------- ----------- --------- ----------------------------
❯ ☐ 2022-11-01 6.2.1 yes 6.2.1 stable latest
☐ 2022-09-24 6.2.0 no 6.2.0 stable
☐ 2022-09-11 6.1.0 no 6.1.0 stable
☐ 2022-07-03 6.0.1 no 6.0.1 stable
☐ 2022-05-26 6.0.0 no 6.0.0 stable
(Move up and down to reveal more choices)
Expected behavior
When stdin or stdout is not a tty, the tool should simply run and list all versions, and not block on stdin.
Such interactive use should be a different command (select) and not just list -- a list command
should simply list the versions.
$ openapi-generator-cli version-manager list | grep yes
❯ ☐ 2022-11-01 6.2.1 yes 6.2.1 stable latest
☒ 2022-01-31 5.4.0 yes 5.4.0 stable
$
Operation System (please complete the following information):
- OS: macos
- Version 12.6
Package System (please complete the following information):
- Version 5.4
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。