about summary refs log tree commit diff
path: root/src/libmain/shared.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-20T19·22+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-20T19·22+0200
commit9481f7769390b934fba92441be32b39287cc93d7 (patch)
tree53786a3e5e4f3078c41470317f38469b8eab7c3c /src/libmain/shared.cc
parentc93690a68abdc6e39f2790d7960420bba46da555 (diff)
Provide reasonable default flags for $LESS
Borrowed from systemd.
Diffstat (limited to 'src/libmain/shared.cc')
-rw-r--r--src/libmain/shared.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 263e1744c089..5a740367ca12 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -305,13 +305,14 @@ RunPager::RunPager()
     pid = startProcess([&]() {
         if (dup2(toPager.readSide, STDIN_FILENO) == -1)
             throw SysError("dupping stdin");
+        if (!getenv("LESS"))
+            setenv("LESS", "FRSXMK", 1);
         execl("/bin/sh", "sh", "-c", pager.c_str(), NULL);
         throw SysError(format("executing ‘%1%’") % pager);
     });
 
     if (dup2(toPager.writeSide, STDOUT_FILENO) == -1)
         throw SysError("dupping stdout");
-
 }