File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -231,18 +231,21 @@ var shellCmd = &cobra.Command{
231231 if len (splitQueries ) > 0 {
232232 for i , s := range splitQueries {
233233 if i == len (splitQueries )- 1 && ! hasRHSSemiColon {
234+ // Last piece has no trailing semicolon;
235+ // accumulate for multi-line continuation.
234236 sb .Reset ()
235237 sb .WriteString (s )
238+ continue
236239 }
237- line = s
238- sb .WriteString (" " + line )
240+ sb .WriteString (" " + s )
239241 rawQuery := sb .String ()
240242 queryToExecute , qErr := entryutil .PreprocessInline (runtimeCtx , rawQuery )
241243 if qErr != nil {
242244 io .WriteString (outErrFile , "\r \n " + qErr .Error ()+ "\r \n " ) //nolint:errcheck // TODO: investigate
243245 }
244246 l .WriteToHistory (rawQuery ) //nolint:errcheck // TODO: investigate
245247 sessionRunnerInstance .RunCommand (queryToExecute )
248+ sb .Reset ()
246249 }
247250 } else {
248251 sb .WriteString (" " + line )
You can’t perform that action at this time.
0 commit comments