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

Fix query batch mode returning zero exit code when rows return errors. Closes #3044 #3046

Merged
merged 7 commits into from
Feb 3, 2023

Conversation

pskrbasu
Copy link
Contributor

No description provided.

@pskrbasu pskrbasu added the bug Something isn't working label Jan 30, 2023
@pskrbasu pskrbasu self-assigned this Jan 30, 2023
@pskrbasu pskrbasu linked an issue Jan 30, 2023 that may be closed by this pull request
cmd/query.go Outdated
@@ -135,7 +135,7 @@ func runQueryCmd(cmd *cobra.Command, args []string) {
}
defer initData.Cleanup(ctx)

var failures int
var failures, rowErrors int
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a need to distinguish between failures and rowErrors - can't we just use a single var?

@@ -53,7 +53,8 @@ func EnableTiming() DisplayOption {
}

// ShowOutput displays the output using the proper formatter as applicable
func ShowOutput(ctx context.Context, result *queryresult.Result, opts ...DisplayOption) {
func ShowOutput(ctx context.Context, result *queryresult.Result, opts ...DisplayOption) int {
rowErr := 0
Copy link
Contributor

Choose a reason for hiding this comment

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

rowErrors

// print the data as it comes
for r := range resultsStreamer.Results {
display.ShowOutput(ctx, r, display.ShowTimingOnOutput(constants.OutputFormatTable))
rowErr = display.ShowOutput(ctx, r, display.ShowTimingOnOutput(constants.OutputFormatTable))
Copy link
Contributor

Choose a reason for hiding this comment

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

rowErrors

@kaidaguerre kaidaguerre merged commit 6ee0183 into v0.18.x Feb 3, 2023
@kaidaguerre kaidaguerre deleted the 3044-return-non-zero-exit-for-row-errors branch February 3, 2023 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Steampipe returns 0 exit code when a plugin fails to do "something"
2 participants