Skip to content

Commit

Permalink
Fix issue where steampipe query was returning exit code 0 even when t…
Browse files Browse the repository at this point in the history
…here was an error. Closes #4451
  • Loading branch information
pskrbasu committed Nov 28, 2024
1 parent 0edac32 commit fef3ab8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/db/db_client/db_client_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,12 @@ func (c *DbClient) startQuery(ctx context.Context, conn *pgx.Conn, query string,

select {
case <-doneChan:
// once we are done, Err() on the returned rows must be checked after the rows is closed to
// determine if the query executed successfully.
rows.Close()
if rows.Err() != nil {
err = rows.Err()
}
case <-ctx.Done():
err = ctx.Err()
}
Expand Down

0 comments on commit fef3ab8

Please sign in to comment.