libmain: always print all information when calling nix --version

This commit remove a check for the log level in the `printVersion()`
function that was making `nix --version` behaving weirdly and
inconsistently compared to other `nix-*` commands.

The root cause is the following code in `lix/nix/main.cc` that change
the log level at runtime if nix is call interactively:

```cpp
if (isatty(STDERR_FILENO)) {
  verbosity = lvlNotice;
} else {
  verbosity = lvlInfo;
}
```

This should be removed, but since it has more implication it's gonna be
done in another CL.

Fix: https://git.lix.systems/lix-project/lix/issues/620
Change-Id: Id2c83c51d7ef799ee2f9b8dbdd2bfaeaf2df6188
This commit is contained in:
Justin !
2025-01-16 22:56:42 -05:00
parent 9760c00591
commit 0d14c2b67a
-2
View File
@@ -270,7 +270,6 @@ bool LegacyArgs::processArgs(const Strings & args, bool finish)
void printVersion(const std::string & programName)
{
std::cout << fmt("%1% (Lix, like Nix) %2%", programName, nixVersion) << std::endl;
if (verbosity > lvlNotice) {
Strings cfg;
#if HAVE_BOEHMGC
cfg.push_back("gc");
@@ -286,7 +285,6 @@ void printVersion(const std::string & programName)
std::cout << "Store directory: " << settings.nixStore << "\n";
std::cout << "State directory: " << settings.nixStateDir << "\n";
std::cout << "Data directory: " << settings.nixDataDir << "\n";
}
throw Exit();
}