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

scripts/install-nix-from-closure: only show progress if a terminal is used #4468

Merged
merged 1 commit into from Jan 25, 2021

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented Jan 21, 2021

While the progress dots during the copying of the store work fine on a
normal terminal, those look pretty off if the script is run inside a
provisioning script of e.g. vagrant or packer where stderr and
stdout are captured:

default: .
default: ..
default: .
default: .
default: .

To work around this, the script checks with -t 0 if it's
running on an actual terminal and doesn't show the progress if that's not
the case.

@SuperSandro2000
Copy link
Member

Would it be reasonable to detect if the command is not run in an interactive shell and then activate this automatically?

@edolstra
Copy link
Member

I agree it would probably be better to just check for a terminal (if [ -t 0 ]; ...) and disable the progress indicator automatically.

… used

While the progress dots during the copying of the store work fine on a
normal terminal, those look pretty off if the script is run inside a
provisioning script of e.g. `vagrant` or `packer` where `stderr` and
`stdout` are captured:

    default: .
    default: ..
    default: .
    default: .
    default: .

To work around this, the script checks with `-t 0` if it's
running on an actual terminal and doesn't show the progress if that's not
the case.
@Ma27 Ma27 changed the title scripts/install-nix-from-closure: add --no-progress option scripts/install-nix-from-closure: only show progress if a terminal is used Jan 22, 2021
@Ma27
Copy link
Member Author

Ma27 commented Jan 22, 2021

@edolstra @SuperSandro2000 updated the PR :)

@Ma27
Copy link
Member Author

Ma27 commented Jan 25, 2021

cc @edolstra anything else to do ? :)

@edolstra edolstra merged commit 29edbfe into NixOS:master Jan 25, 2021
@Ma27 Ma27 deleted the installer-no-progress-opt branch January 25, 2021 11:24
@Ma27
Copy link
Member Author

Ma27 commented Jan 25, 2021

@edolstra is there any chance to include this in the next 2.3.x if another one is planned? This is for at least one project I'm working on an improvement as this would make the provisioning output readable :)

@edolstra
Copy link
Member

Yes, I've just cherry-picked it to 2.3 branch.

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

Successfully merging this pull request may close these issues.

None yet

3 participants