diff --git a/handler/handler.go b/handler/handler.go index ba9a24a2fc..0b03c72254 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -1044,7 +1044,7 @@ func (h *Handler) doExecWatch(ctx context.Context, w io.Writer, opt metacmd.Opti // doExecChart executes a single query against the database, displaying its output as a chart. func (h *Handler) doExecChart(ctx context.Context, w io.Writer, opt metacmd.Option, prefix, sqlstr string, qtyp bool, bind []interface{}) error { - stdout, _, _ := h.l.Stdout(), h.l.Stderr(), h.l.Interactive() + stdout := h.l.Stdout() typ := env.TermGraphics() if !typ.Available() { return text.ErrGraphicsNotSupported @@ -1063,6 +1063,7 @@ func (h *Handler) doExecChart(ctx context.Context, w io.Writer, opt metacmd.Opti if err != nil { return err } + defer rows.Close() // get cols cols, err := drivers.Columns(h.u, rows) if err != nil { @@ -1150,6 +1151,7 @@ func (h *Handler) doExecSet(ctx context.Context, w io.Writer, opt metacmd.Option if err != nil { return err } + defer rows.Close() // get cols cols, err := drivers.Columns(h.u, rows) if err != nil { @@ -1190,6 +1192,7 @@ func (h *Handler) doExecExec(ctx context.Context, w io.Writer, _ metacmd.Option, if err != nil { return err } + defer rows.Close() // exec resulting rows if err := h.doExecRows(ctx, w, rows); err != nil { return err