about summary refs log tree commit diff stats
path: root/src/local/client.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-20 21:17:34 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-20 21:17:34 +0100
commit4d82d078f95a9654d1d8f2d0c95880ed723790fb (patch)
tree82941487a5cde050c71fcc8f20c8089c91fa1321 /src/local/client.nim
parent46e247439b4a658e311a0aa81233b7f8241c1481 (diff)
downloadchawan-4d82d078f95a9654d1d8f2d0c95880ed723790fb.tar.gz
client: fix dump detection
it wouldn't start dump mode if stdout was not a tty but stdin was.
Diffstat (limited to 'src/local/client.nim')
-rw-r--r--src/local/client.nim14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/local/client.nim b/src/local/client.nim
index c4358c4d..d41fa0d9 100644
--- a/src/local/client.nim
+++ b/src/local/client.nim
@@ -693,13 +693,13 @@ proc launchClient*(client: Client; pages: seq[string];
   if not dump:
     if stdin.isatty():
       istream = newPosixStream(stdin.getFileHandle())
-    if istream == nil:
-      if stdout.isatty():
-        istream = newPosixStream("/dev/tty", O_RDONLY, 0)
-        if istream == nil:
-          dump = true
-      else:
-        dump = true
+    dump = istream == nil
+    if stdout.isatty():
+      istream = newPosixStream("/dev/tty", O_RDONLY, 0)
+      if istream != nil:
+        dump = false
+    else:
+      dump = true
   let selector = newSelector[int]()
   let efd = int(client.forkserver.estream.fd)
   selector.registerHandle(efd, {Read}, 0)