diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-05-15T15·33+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-05-15T15·33+0200 |
commit | 66b8a62101cb1dfe2e368346cf99efd32e9328ae (patch) | |
tree | 4ef5a346b159b93a6b1ce6839b30bac5fb23a3c4 /src/nix/main.cc | |
parent | 83f2b110cecf50877ce1585c698dbed6dd225562 (diff) |
nix: Add --print-build-logs flag
This causes 'nix' to print build log output to stderr rather than showing the last log line in the progress bar. Log lines are prefixed by the name of the derivation (minus the version string), e.g. binutils> make[1]: Leaving directory '/build/binutils-2.31.1' binutils-wrapper> unpacking sources binutils-wrapper> patching sources ... binutils-wrapper> Using dynamic linker: '/nix/store/kr51dlsj9v5cr4n8700jliyz8v5b2q7q-bootstrap-stage0-glibc/lib/ld-linux-x86-64.so.2' bootstrap-stage2-gcc-wrapper> unpacking sources ... linux-headers> unpacking sources linux-headers> unpacking source archive /nix/store/8javli69jhj3bkql2c35gsj5vl91p382-linux-4.19.16.tar.xz
Diffstat (limited to 'src/nix/main.cc')
-rw-r--r-- | src/nix/main.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nix/main.cc b/src/nix/main.cc index 64c1dc35787c..4f87ad72b65c 100644 --- a/src/nix/main.cc +++ b/src/nix/main.cc @@ -20,6 +20,8 @@ std::string programPath; struct NixArgs : virtual MultiCommand, virtual MixCommonArgs { + bool printBuildLogs = false; + NixArgs() : MultiCommand(*RegisterCommand::commands), MixCommonArgs("nix") { mkFlag() @@ -42,6 +44,11 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs }); mkFlag() + .longName("print-build-logs") + .description("print full build logs on stderr") + .set(&printBuildLogs, true); + + mkFlag() .longName("version") .description("show version information") .handler([&]() { printVersion(programName); }); @@ -98,8 +105,7 @@ void mainWrapped(int argc, char * * argv) Finally f([]() { stopProgressBar(); }); - if (isatty(STDERR_FILENO)) - startProgressBar(); + startProgressBar(args.printBuildLogs); args.command->prepare(); args.command->run(); |