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

nix path-info: Don't write to std::cout directly #11884

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

edolstra
Copy link
Member

Motivation

This interferes with the progress bar, resulting in output like

evaluating derivation 'git+file:///home/eelco/Dev/nix-master#packages.x86_64-linux.default'/nix/store/zz8v96j5md952x0mxfix12xqnvq5qv5x-nix-2.26.0pre20241114_a95f6ea.drv

Context

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

This interferes with the progress bar, resulting in output like

  evaluating derivation 'git+file:///home/eelco/Dev/nix-master#packages.x86_64-linux.default'/nix/store/zz8v96j5md952x0mxfix12xqnvq5qv5x-nix-2.26.0pre20241114_a95f6ea.drv
@edolstra edolstra added the backport 2.25-maintenance Automatically creates a PR against the branch label Nov 14, 2024
@github-actions github-actions bot added the new-cli Relating to the "nix" command label Nov 14, 2024
Copy link
Member

@roberth roberth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix

@roberth
Copy link
Member

roberth commented Nov 15, 2024

Technically this loses the streaming property, but that doesn't seem so bad.
It would be nice to have a logger->cout that does support streaming. It'd have to be an ostream implementation that performs line buffering and then calls another stream or a callback with the line, where we pass the cout() method.
(but again, nice to have)

@roberth roberth added the backport 2.24-maintenance Automatically creates a PR against the branch label Nov 15, 2024
@edolstra
Copy link
Member Author

Technically this loses the streaming property

AFAIK logger->cout() is still streaming (i.e. the line is written immediately and not buffered).

@edolstra edolstra merged commit b479036 into NixOS:master Nov 15, 2024
11 checks passed
@edolstra edolstra deleted the nix-path-info-cout branch November 15, 2024 14:07
edolstra added a commit that referenced this pull request Nov 15, 2024
…1884

nix path-info: Don't write to std::cout directly (backport #11884)
@Ericson2314
Copy link
Member

Well I assume @roberth means get a std::ostream from the logger so we don't buffer a string explicitly, even if that string ends up being one line and would be buffered anyways.

@roberth roberth added backport 2.25-maintenance Automatically creates a PR against the branch and removed backport 2.25-maintenance Automatically creates a PR against the branch labels Nov 26, 2024
@roberth
Copy link
Member

roberth commented Nov 26, 2024

It should be possible to have a cout that coordinates its timing with the progress bar to avoid clobbering, and this could be done perhaps by implementing ostream in a custom way, or using an internal pipe.

edolstra added a commit that referenced this pull request Nov 26, 2024
…1884

nix path-info: Don't write to std::cout directly (backport #11884)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.24-maintenance Automatically creates a PR against the branch backport 2.25-maintenance Automatically creates a PR against the branch new-cli Relating to the "nix" command
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants