Skip to content

Commit

Permalink
mcap recover: print status message to stderr instead of stdout (#1289)
Browse files Browse the repository at this point in the history
### Changelog
Fixed a bug in `mcap recover` which would produce an invalid file when
redirecting stdout to a file.

### Docs

None

### Description

Status message now goes to stderr instead of stdout.

Also fixed another nearby line which looked wrong, it was using Fprintln
with `%w` but Fprintln doesn't accept format strings.
https://pkg.go.dev/fmt#Fprintln
  • Loading branch information
jtbandes authored Dec 12, 2024
1 parent 00badb9 commit 4948ad4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions go/cli/mcap/cmd/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,12 @@ func filter(
defer func() {
err := mcapWriter.Close()
if err != nil {
fmt.Fprintln(os.Stderr, "failed to close mcap writer: %w", err)
fmt.Fprintf(os.Stderr, "failed to close mcap writer: %v\n", err)
return
}
if opts.recover {
fmt.Printf(
fmt.Fprintf(
os.Stderr,
"Recovered %d messages, %d attachments, and %d metadata records.\n",
numMessages,
numAttachments,
Expand Down

0 comments on commit 4948ad4

Please sign in to comment.