about summary refs log tree commit diff stats
path: root/adapter/format
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-02-26 15:26:46 +0100
committerbptato <nincsnevem662@gmail.com>2024-02-26 15:26:46 +0100
commit973e8f942855fe9a17f0245948984bf9841f9ffa (patch)
tree8ab60f658881df53901d4a843fd5c090b8c632bc /adapter/format
parentcf1e026b85972135170c80e22b83b4567a5d1099 (diff)
downloadchawan-973e8f942855fe9a17f0245948984bf9841f9ffa.tar.gz
loader: clean up regular file loading
* Get rid of sostream hack

This is no longer needed, and was in fact causing loadStream to get
stuck with redirects on regular files (i.e. the common case of receiving
<file on stdin without a -T content type override).

* Unify loading from cache and stdin regular file code paths

Until now, loadFromCache was completely sync. This is not a huge
problem, but it's better to make it async *and* not have two separate
procedures for reading regular files. (In fact, loadFromCache had
*another* bug related to its output fd not being added to outputMap.)

* Extra: remove ansi2html select error handling

It was broken, because it didn't handle read events before the
error. Also unnecessary, since recvData breaks from the loop on n == 0.
Diffstat (limited to 'adapter/format')
-rw-r--r--adapter/format/ansi2html.nim5
1 files changed, 1 insertions, 4 deletions
diff --git a/adapter/format/ansi2html.nim b/adapter/format/ansi2html.nim
index 48eaf5a2..dbb3faab 100644
--- a/adapter/format/ansi2html.nim
+++ b/adapter/format/ansi2html.nim
@@ -371,10 +371,7 @@ proc main() =
       except ErrorAgain:
         state.flushOutbuf()
         selector.registerHandle(ps.fd, {Read}, 0)
-        let events = selector.select(-1)
-        for event in events:
-          if Error in event.events:
-            break mainloop
+        discard selector.select(-1)
         selector.unregister(ps.fd)
   state.flushOutbuf()