Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functionality to disable fancy progress reporting without setting TERM=dumb #2475

Open
emilazy opened this issue Aug 10, 2024 · 3 comments
Labels
Milestone

Comments

@emilazy
Copy link

emilazy commented Aug 10, 2024

In Nixpkgs we call Ninja with TERM=dumb ninja to get build progress on separate lines in our build logs. This generally works fine and was recommended as the solution in e.g. #2102.

However, there is one notable drawback: this propagates down to the child build processes in ways that can be undesirable. For example, we don’t get colourized output from rustc/cargo when they are run inside a Ninja build as a result of this, even though colours are much easier for us to handle than lines getting overwritten. A more impactful issue is that TERM=dumb makes Node.js skip several terminal‐related tests that otherwise pass fine for us.

I would be happy to send a pull request to add this functionality if a colour of bikeshed can be agreed on (CLI flag, NINJA_* environment variable, etc.).

@jhasse jhasse added this to the 2.0.0 milestone Aug 12, 2024
@digit-google
Copy link
Contributor

Can you try the equivalent of ninja | cat in your build environment? This disables smart terminal support without changing the environment, or requiring extra Ninja options. The TERM variable will be unchanged, but the downstream processes will not see a smart terminal either, which seems to be more consistent.

@emilazy
Copy link
Author

emilazy commented Aug 12, 2024

That would probably be an improvement, but unfortunately I think it wouldn’t be a very satisfactory solution for us. For instance, build tools like cargo and rustc will see a non‐TTY and not give colour output.

Of course, we could add manual overrides and patches for all the build tools and tests we might run inside Ninja builds, but ideally we’d just be able to get them to see the same environment they do when run under another tool like Make, and simply opt out of the fancy Ninja output that disrupts our use case. I suppose the platonic ideal solution would be to have a TERM setting that represents the ability to handle colours but not rewriting lines, but obviously it’s not very practical to get the entire world to support that.

@digit-google
Copy link
Contributor

I see, I assume your are collecting logs through a tool such as script to explicitly mark the output descriptor passed to Ninja as interactive, even though it writes to a file, to keep the colors in the resulting logs. In this case, yes, a Ninja-specific option / setting would be needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants