about summary refs log tree commit diff stats
path: root/src/io
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 /src/io
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 'src/io')
-rw-r--r--src/io/posixstream.nim1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/io/posixstream.nim b/src/io/posixstream.nim
index c9c1c234..da1a8a62 100644
--- a/src/io/posixstream.nim
+++ b/src/io/posixstream.nim
@@ -51,7 +51,6 @@ proc recvData*(s: PosixStream, buffer: var openArray[char]): int {.inline.} =
   return s.recvData(addr buffer[0], buffer.len)
 
 method sendData*(s: PosixStream, buffer: pointer, len: int): int {.base.} =
-  #TODO use sendData instead
   let n = write(s.fd, buffer, len)
   if n < 0:
     raisePosixIOError()