diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index 2c9e9fbd74fa..5164929c829d 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -576,9 +576,7 @@ ProcessLineResult NixRepl::processLine(std::string line) subs.push_front(state->store); bool foundLog = false; -#ifndef __WIN32 RunPager pager; -#endif for (auto & sub : subs) { auto * logSubP = dynamic_cast(&*sub); if (!logSubP) { diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 2feff7c504cb..e2803fc027a4 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -365,7 +365,6 @@ int handleExceptions(const std::string & programName, std::function fun) return 0; } -#ifndef __WIN32 RunPager::RunPager() { if (!isatty(STDOUT_FILENO)) return; @@ -375,6 +374,7 @@ RunPager::RunPager() stopProgressBar(); +#ifndef __WIN32 Pipe toPager; toPager.create(); @@ -396,11 +396,13 @@ RunPager::RunPager() std_out = fcntl(STDOUT_FILENO, F_DUPFD_CLOEXEC, 0); if (dup2(toPager.writeSide.get(), STDOUT_FILENO) == -1) throw SysError("dupping standard output"); +#endif } RunPager::~RunPager() { +#ifndef __WIN32 try { if (pid != -1) { std::cout.flush(); @@ -410,8 +412,8 @@ RunPager::~RunPager() } catch (...) { ignoreException(); } -} #endif +} PrintFreed::~PrintFreed() diff --git a/src/libmain/shared.hh b/src/libmain/shared.hh index afe560f60fc8..3a00b56503f6 100644 --- a/src/libmain/shared.hh +++ b/src/libmain/shared.hh @@ -84,7 +84,6 @@ void showManPage(const std::string & name); * terminal and $PAGER is set. Standard output is redirected to the * pager. */ -#ifndef __WIN32 class RunPager { public: @@ -92,10 +91,11 @@ public: ~RunPager(); private: +#ifndef __WIN32 Pid pid; int std_out; -}; #endif +}; extern volatile ::sig_atomic_t blockInt; diff --git a/src/nix/log.cc b/src/nix/log.cc index 4c7185831ec3..156004b9f07b 100644 --- a/src/nix/log.cc +++ b/src/nix/log.cc @@ -50,9 +50,7 @@ struct CmdLog : InstallableCommand }, b.path.raw()); auto path = resolveDerivedPath(*store, *oneUp); -#ifndef __WIN32 RunPager pager; -#endif for (auto & sub : subs) { auto * logSubP = dynamic_cast(&*sub); if (!logSubP) { diff --git a/src/nix/main.cc b/src/nix/main.cc index a078aa31d373..a06981277f61 100644 --- a/src/nix/main.cc +++ b/src/nix/main.cc @@ -273,9 +273,7 @@ static void showHelp(std::vector subcommand, NixArgs & toplevel) auto markdown = state.forceString(*attr->value, noPos, "while evaluating the lowdown help text"); -#ifndef __WIN32 RunPager pager; -#endif std::cout << renderMarkdownToTerminal(markdown) << "\n"; } diff --git a/src/nix/why-depends.cc b/src/nix/why-depends.cc index aafc9cdceaf7..e299585ff88e 100644 --- a/src/nix/why-depends.cc +++ b/src/nix/why-depends.cc @@ -291,9 +291,7 @@ struct CmdWhyDepends : SourceExprCommand, MixOperateOnOptions } }; -#ifndef __WIN32 RunPager pager; -#endif try { if (!precise) { logger->cout("%s", store->printStorePath(graph.at(packagePath).path));