Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ticdc/server: output the cdc server cmd error to stderr #3520

Merged
merged 24 commits into from
Nov 29, 2021
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ac72564
output the cdc server cmd error to stderr, so as to convenietly do tr…
zhaoxinyu Nov 18, 2021
6e55e5c
address comment and upgrade cobra to a latest release version
zhaoxinyu Nov 19, 2021
ccff238
Merge branch 'master' into fix_error_capture_in_cdclog
zhaoxinyu Nov 19, 2021
bd1acd2
Merge branch 'master' into fix_error_capture_in_cdclog
zhaoxinyu Nov 22, 2021
f367857
update go.sum to solve the compile problem
zhaoxinyu Nov 23, 2021
cc1ae36
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 23, 2021
c939927
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 23, 2021
135fe8a
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 23, 2021
606628e
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 24, 2021
d94e36c
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 24, 2021
a702695
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 24, 2021
b9d0f45
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 24, 2021
54db259
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 24, 2021
0e9c4fe
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 26, 2021
015c28a
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 26, 2021
a21919a
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 26, 2021
5419eb0
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 26, 2021
5ea9257
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 26, 2021
fc91adf
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 29, 2021
4302548
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 29, 2021
6544708
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 29, 2021
95e15bb
handle dmctl help flag correctly after upgrading cobra
zhaoxinyu Nov 29, 2021
f32d10b
Merge branch 'master' into fix_error_capture_in_cdclog
ti-chi-bot Nov 29, 2021
c67ff9d
remove the default completion command generated by cobra
zhaoxinyu Nov 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func NewCmd() *cobra.Command {
func Run() {
cmd := NewCmd()

// Outputs cmd.Print to stdout.
cmd.SetOut(os.Stdout)
// Outputs cmd.Print to stderr.
cmd.SetOut(os.Stderr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you redrict err output to stderr?

cmd.SetOut(os.Stdout)
cmd.SetErr(os.Stderr)
...
cmd.PrintErr(err) // line 48

Copy link
Contributor Author

@zhaoxinyu zhaoxinyu Nov 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, use cmd.PrintErr to print error message to stderr is more natural. And maybe we should use cmd.PrintErrln here to print error with new line. But after testing with cmd.PrintErrln, it does not work as expected. cmd.PrintErrln prints error message to stdout, see cobra issue 1100.

Copy link
Contributor Author

@zhaoxinyu zhaoxinyu Nov 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can replace v1.0.0 cobra with v1.2.1 in go.mod.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let's upgrade cobra.


cmd.AddCommand(server.NewCmdServer())
cmd.AddCommand(cli.NewCmdCli())
Expand Down