You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you pipe the output of a multi-line function (in a shell script), only the first line’s output goes into the pipe, and the rest goes direct to stdout. This is the second issue I had pointed out in #859. The difference between quoted and unquoted versions of the variable I pointed out earlier was a red herring because echoing an unquoted multi-line variable is supposed to replace the newlines with spaces when being displayed.
Thank you for opening this issue. Unlike #859, this one is going to take a longer time to fix. I know roughly where it happens, but not why. The standard output that is piped into the command is closed after the first line of the function; trying to keep it open results in a lot of undesirable behaviour in other places. I'll keep working on it, but it's a tough one.
sultanqasim
changed the title
Only first line of a function output gets passed through pipe
Only first line of a function’s output gets passed through pipe
Dec 4, 2024
When you pipe the output of a multi-line function (in a shell script), only the first line’s output goes into the pipe, and the rest goes direct to stdout. This is the second issue I had pointed out in #859. The difference between quoted and unquoted versions of the variable I pointed out earlier was a red herring because echoing an unquoted multi-line variable is supposed to replace the newlines with spaces when being displayed.
Reproduction script:
Expected output:
a-Shell output:
The text was updated successfully, but these errors were encountered: