hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit b0806f691c23c502c662c147f62fad1773815825
parent 06797ee67a09f341f4bc6991d2717c00614838bf
Author: Autumn! <autumnull@posteo.net>
Date:   Thu,  2 Mar 2023 00:50:19 +0000

haredoc: Don't overwrite $LESS and $MORE

Signed-off-by: Autumn! <autumnull@posteo.net>

Diffstat:
Mcmd/haredoc/main.ha | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/cmd/haredoc/main.ha b/cmd/haredoc/main.ha @@ -288,11 +288,11 @@ fn init_tty(ctx: *context) io::handle = { return os::stdout; }; case void => - yield match (exec::cmd("less")) { + yield match (exec::cmd("less", "-R")) { case let cmd: exec::command => yield cmd; case exec::error => - yield match (exec::cmd("more")) { + yield match (exec::cmd("more", "-R")) { case let cmd: exec::command => yield cmd; case exec::error => @@ -303,7 +303,9 @@ fn init_tty(ctx: *context) io::handle = { const pipe = exec::pipe(); exec::addfile(&pager, os::stdin_file, pipe.0); - exec::setenv(&pager, "LESS", "FRX")!; + // Get raw flag in if possible + exec::setenv(&pager, "LESS", os::tryenv("LESS", "R"))!; + exec::setenv(&pager, "MORE", os::tryenv("MORE", "R"))!; ctx.pager = exec::start(&pager)!; return pipe.1; };