[PATCH] Insert \n before cmd output when input is not a tty.

Zach Brown zab at zabbo.net
Mon Apr 7 10:52:27 PDT 2025


On Fri, Mar 28, 2025 at 11:20:37AM -0700, Auke Kok wrote:
> The output of piped input commands used by the tests is causing the
> output to be concatenated on the line unless the cmd output itself
> contains newlines. This is because when input is a pipe, we're not going
> to be outputting the cmd's implicit newline.
> 
> This makes the output of test scripts a little awkward to read as we're
> seeing test output that is relevant pre-pended with several <> line
> headings.

If the intent is to make the output less awkward to read, let's also add
the command that's being executed itself before the newline that we're
adding.

> +	/* if our stdin is not a tty, we want to insert newlines after each cmd */
> +	is_tty = isatty(fileno(stdin));

Can use STDIN_FILENO and make this a bit simpler.

- z



More information about the ngnfs-devel mailing list