Provide reasonable default flags for $LESS

Borrowed from systemd.
This commit is contained in:
Eelco Dolstra 2014-08-20 21:22:41 +02:00
parent c93690a68a
commit 9481f77693

View file

@ -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");
}