Command hints print to stdout when output is piped

オープン 初心者向け
#2,531 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
77/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
cli

調査の方向性

まず packages/cli/src/lib/command.ts で writeFinalization がヒントと stdout をどのように扱うかを確認し、次に packages/cli/src/commands/release/propose-version.ts を調べて、ヒントを返すコマンドを確認してください。stdout が TTY ではない場合にヒントをどう扱うかを決めて実装し、対話的な出力では現在の動作を維持してください。propose-version の出力をパイプに渡したときにバージョンだけが含まれ、ヒントを返す他のコマンドも一貫して動作すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

In human output mode, the hint a command returns is written to stdout after the result, even when stdout isn't a TTY. So sentry release propose-version prints the version and then a Detected from git HEAD line. Scripts that capture it get two lines.

  • writeFinalization in packages/cli/src/lib/command.ts writes the hint with writeFooter(stdout, hint) whenever --json isn't set. It never checks whether stdout is a TTY.
  • propose-version returns { hint: "Detected from <source>" } on every path (packages/cli/src/commands/release/propose-version.ts).
  • Generated build scripts in the sentry wizard port (getsentry/toolkit#2529) and the Sentry UI snippets (getsentry/sentry#132671) work around it with sentry release propose-version | head -n 1. The pipe hides a failing exit code, so SENTRY_RELEASE ends up empty and the next step runs anyway.
  • It applies to any command that returns a hint, not just propose-version.

Proposal (approved by @BYK): when stdout isn't a TTY, send hints to stderr, or leave them out.

via @BYK.

--

View Session [Sentry]

主要言語
TypeScript
スター
975
フォーク
189
平均マージ
19時間 57分
マージ済み PR(30日)
542

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

getsentry/toolkit のほかの issue

getsentry/toolkit の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。