Provide reasonable default flags for $LESS
Borrowed from systemd.
This commit is contained in:
parent
c93690a68a
commit
9481f77693
1 changed files with 2 additions and 1 deletions
|
@ -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");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue