n2 icon indicating copy to clipboard operation
n2 copied to clipboard

better control over subcommand output

Open evmar opened this issue 1 year ago • 2 comments

In #68 @dae mentioned:

It would be great to have some sort of option like a build variable that could suppress the aggregated output in the success case, as while I love the extra insight during build, I'd miss the clean output if I had to decide on only one of the two.

The current n2 behavior is

  • the last line of task output is shown while it's running
  • all task output is displayed once a task completes

The use case here is there are commands that display a lot of progress output (e.g. a test runner), but that progress output is ultimately not useful to show specifically in the case where the task succeeds. Another example of such a command is if a task is itself executing another build system (e.g. Cargo) that only displays build progress -- if the task's build succeeds we don't need to display anything.

We could do something like "only print a full log if the task fails", but also it seems plausible there are cases where you do want to see the full output. For example the tail of the output of LLVM's check-lld task looks like

-- Testing: 2732 tests, 8 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 

Testing Time: 9.99s
  Unsupported: 2352
  Passed     :  380

Where I imagine it's good to display the "testing time" line.

So perhaps this is something to make configurable on a per-task basis?

evmar avatar Jan 08 '24 19:01 evmar

Digging into the LLVM build, it appears check-lld is tagged into the console pool.

evmar avatar Jan 08 '24 20:01 evmar

I presume their primary motivation for using the console pool in this case is so they can see the 10..20.. part update in real time. The testing time seems a bit less useful, since n2 is already displaying a counter as the command runs.

That said, I do think it would make sense to make a "hide output on success" setting configurable on a per-command basis, as there are other times where it would be useful (e.g. one might want a build step that outputs things like warnings, or generated auth info, or instructions for the user)

dae avatar Jan 08 '24 22:01 dae