You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "chennaji9 (via GitHub)" <gi...@apache.org> on 2026/09/30 08:10:34 UTC

[PR] fix(rmqctl): report failures when version output cannot be written [rocketmq-dashboard]

chennaji9 opened a new pull request, #5209:
URL: https://github.com/apache/rocketmq-dashboard/pull/5209

   ### Which Issue(s) This PR Fixes
   
   None — small self-contained fix found by inspection (no issue tracked).
   
   ### Brief Description
   
   The text branch of `rmqctl version` ignored `fmt.Fprintf` errors and always returned `nil`, so with an unusable stdout the command still exited 0 — while the JSON and YAML branches do surface encoder write errors. Each line write is now checked and the error is wrapped (`write version output: …`), making all three output modes consistent. A `version_test.go` covers both paths with a failing writer plus a normal-output regression.
   
   Base is `rocketmq-studio` per CONTRIBUTING.md (the PR template's base comment is outdated).
   
   ### How Did You Test This Change?
   
   `cd rmqctl && go test -race -count=1 ./cmd/` → `ok github.com/apache/rocketmq-dashboard/rmqctl/cmd 1.878s` (includes the new `TestVersionCommand` subtests `versionTextOutputSucceedsTest` and `versionTextOutputFailureIsReportedTest`).
   `go vet ./...` → clean. `gofmt -l cmd/` → no output.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`fix:`)
   - [x] Tests added or updated for non-trivial changes (`rmqctl/cmd/version_test.go`)
   - [x] New UI text has both Chinese and English entries under `web/src/i18n/` (n/a — no UI change)
   - [x] Architecture constraints stay green (n/a — no Java change)
   - [x] New source files carry the ASF license header (`version_test.go` included)
   - [x] Documentation touched where behaviour changed (n/a — internal error handling)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(rmqctl): report failures when version output cannot be written [rocketmq-dashboard]

Posted by "chennaji9 (via GitHub)" <gi...@apache.org>.
chennaji9 commented on PR #5209:
URL: https://github.com/apache/rocketmq-dashboard/pull/5209#issuecomment-6227378633

   Re-verified against the current tip: the text branch in `rmqctl/cmd/version.go` still ignores every `fmt.Fprintf` result and returns `nil`, so the asymmetry with the JSON/YAML paths is still live on today's base. One additional angle worth noting for the record: the ignored error is reachable through a broken pipe too — if something like `rmqctl version | head -1` closes stdout early, the remaining line writes fail with EPIPE and the command still exits 0, so a script consuming partial output can't tell the print was truncated. The branch applies cleanly after the recent merges.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(rmqctl): report failures when version output cannot be written [rocketmq-dashboard]

Posted by "chennaji9 (via GitHub)" <gi...@apache.org>.
chennaji9 commented on PR #5209:
URL: https://github.com/apache/rocketmq-dashboard/pull/5209#issuecomment-5988151729

   Confirmed the version-output path still returns success when the write fails (error from the writer is dropped before the exit code is set), which is what this fixes. Verified the fix compiles and the surrounding `rmqctl` tests still pass.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(rmqctl): report failures when version output cannot be written [rocketmq-dashboard]

Posted by "chennaji9 (via GitHub)" <gi...@apache.org>.
chennaji9 commented on PR #5209:
URL: https://github.com/apache/rocketmq-dashboard/pull/5209#issuecomment-6259229553

   Hi @lizhimins, gentle follow-up on this one — it has been sitting for quite a while now. Everything (local tests + CI) is green, and the change is deliberately minimal (report failures when version output cannot be written). A review would be really appreciated whenever you have time, and merging would be great if it looks reasonable. Thank you!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(rmqctl): report failures when version output cannot be written [rocketmq-dashboard]

Posted by "chennaji9 (via GitHub)" <gi...@apache.org>.
chennaji9 commented on PR #5209:
URL: https://github.com/apache/rocketmq-dashboard/pull/5209#issuecomment-6520051839

   For consistency context: the JSON and YAML branches already propagated encoder write errors, so this just brings the plain-text branch in line — all three output modes now fail loudly on an unusable stdout instead of exiting 0.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(rmqctl): report failures when version output cannot be written [rocketmq-dashboard]

Posted by "chennaji9 (via GitHub)" <gi...@apache.org>.
chennaji9 commented on PR #5209:
URL: https://github.com/apache/rocketmq-dashboard/pull/5209#issuecomment-6103767613

   Worth noting for review: the only behaviour change is that `rmqctl version` now fails loudly when stdout is genuinely unwritable (e.g. piped to a closed reader) instead of exiting 0. The JSON and YAML branches already surface encoder write errors, so this brings the text path in line without touching anything else — no flag, output format, or exit-code change for healthy writers.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(rmqctl): report failures when version output cannot be written [rocketmq-dashboard]

Posted by "chennaji9 (via GitHub)" <gi...@apache.org>.
chennaji9 commented on PR #5209:
URL: https://github.com/apache/rocketmq-dashboard/pull/5209#issuecomment-6359284461

   Nothing exotic here, just making the text branch match its JSON/YAML siblings: both already surfaced encoder write failures, only the Fprintf path swallowed them and exited 0. The failing-writer test is a few lines and pins the wrapped error on both paths.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org