mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-26 15:56:18 +02:00
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([&]() {
|
pid = startProcess([&]() {
|
||||||
if (dup2(toPager.readSide, STDIN_FILENO) == -1)
|
if (dup2(toPager.readSide, STDIN_FILENO) == -1)
|
||||||
throw SysError("dupping stdin");
|
throw SysError("dupping stdin");
|
||||||
|
if (!getenv("LESS"))
|
||||||
|
setenv("LESS", "FRSXMK", 1);
|
||||||
execl("/bin/sh", "sh", "-c", pager.c_str(), NULL);
|
execl("/bin/sh", "sh", "-c", pager.c_str(), NULL);
|
||||||
throw SysError(format("executing ‘%1%’") % pager);
|
throw SysError(format("executing ‘%1%’") % pager);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (dup2(toPager.writeSide, STDOUT_FILENO) == -1)
|
if (dup2(toPager.writeSide, STDOUT_FILENO) == -1)
|
||||||
throw SysError("dupping stdout");
|
throw SysError("dupping stdout");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue