diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-08-20 21:22:41 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-08-20 21:22:41 +0200 |
commit | 9481f7769390b934fba92441be32b39287cc93d7 (patch) | |
tree | 53786a3e5e4f3078c41470317f38469b8eab7c3c /src | |
parent | c93690a68abdc6e39f2790d7960420bba46da555 (diff) |
Provide reasonable default flags for $LESS
Borrowed from systemd.
Diffstat (limited to 'src')
-rw-r--r-- | src/libmain/shared.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 263e1744c..5a740367c 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"); - } |