On Fri, Jun 30, 2023, 16:02 Chet Ramey <chet.ra...@case.edu> wrote: > On 6/29/23 4:01 AM, Grisha Levit wrote: > > If there are multiple commands in a row that each require printing the > > connector prior to the heredoc body, the connector ends up in the wrong > > place for commands after the first: > > OK. The parser builds lists (connections) left-side heavy. What do you > think of replacing the test for was_heredoc in your patch with > (printing_connection == 1), so if we're called recursively to print a > second connection on the left side (Connector->first), we print the here- > document body after our caller has been able to add the connector in > the right place.
Oh yeah that seems like a much better solution. That way you shouldn't need to print any deferred > here-documents in make_command_string(). > Great, this was the part that made me think something was wrong with my approach. >