mirror of
https://github.com/NixOS/nix.git
synced 2025-11-21 09:49:36 +01:00
Disable the progress bar if stdout is redirected
This commit is contained in:
parent
4b711bf3ce
commit
29ada5105b
1 changed files with 5 additions and 7 deletions
|
|
@ -705,13 +705,8 @@ public:
|
|||
|
||||
void writeToStdout(std::string_view s) override
|
||||
{
|
||||
auto state(state_.lock());
|
||||
if (state->active) {
|
||||
draw(*state, s);
|
||||
} else {
|
||||
Logger::writeToStdout(s);
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<char> ask(std::string_view msg) override
|
||||
{
|
||||
|
|
@ -729,7 +724,10 @@ Logger * makeProgressBar(bool printBuildLogs)
|
|||
{
|
||||
return new ProgressBar(
|
||||
printBuildLogs,
|
||||
isatty(STDERR_FILENO) && getEnv("TERM").value_or("dumb") != "dumb"
|
||||
isatty(STDIN_FILENO)
|
||||
&& isatty(STDOUT_FILENO)
|
||||
&& isatty(STDERR_FILENO)
|
||||
&& getEnv("TERM").value_or("dumb") != "dumb"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue