about summary refs log tree commit diff stats
path: root/src/main.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-01-22 20:55:13 +0100
committerbptato <nincsnevem662@gmail.com>2025-01-22 20:55:13 +0100
commitd0c60a0c06cef3bcf4e307eebfdda715ab67fc00 (patch)
tree27d8146129449dcd0de81456d61822f961aa7689 /src/main.nim
parentd1b6b305ac6460d319f48c8b647347eb9bf8435d (diff)
downloadchawan-d0c60a0c06cef3bcf4e307eebfdda715ab67fc00.tar.gz
pager, term: replace execCmd, File
pager: I want to change mailcap command parsing, so a custom
implementation is needed.

term: now it uses a custom buffer for the output stream too.
I don't think there is much difference in performance, but stdio was in
the way.
(Also, this way it will be easier to make it async in the future.)
Diffstat (limited to 'src/main.nim')
-rw-r--r--src/main.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.nim b/src/main.nim
index 49693aab..e58397fe 100644
--- a/src/main.nim
+++ b/src/main.nim
@@ -254,7 +254,8 @@ proc main() =
     stderr.writeLine(res.error)
     quit(1)
   var history = true
-  if ctx.pages.len == 0 and stdin.isatty():
+  let ps = newPosixStream(STDIN_FILENO)
+  if ctx.pages.len == 0 and ps.isatty():
     if ctx.visual:
       ctx.pages.add(config.start.visualHome)
       history = false
@@ -265,7 +266,7 @@ proc main() =
       ctx.pages.add(wwwHome)
       history = false
   if ctx.pages.len == 0 and not config.start.headless:
-    if stdin.isatty():
+    if ps.isatty():
       help(1)
   # make sure tmpdir exists
   discard mkdir(cstring(config.external.tmpdir), 0o700)