diff options
author | equa <equaa@protonmail.com> | 2022-03-13 18:01:02 +0000 |
---|---|---|
committer | equa <equaa@protonmail.com> | 2022-03-13 18:10:04 +0000 |
commit | 2d581a2b62a398963e4e418243b10e02b8d648af (patch) | |
tree | 992c7352f2451a50e4c6cb20dfdfc5262bc0580e /fifo.lua | |
parent | 199b82b6767dcbe0a3e5cd770402d87e1be04f31 (diff) |
Various fixes
- add directory configuration option - add debug mode for checking output - fix FIFOs not actually being FIFOs - add user and pass configuration options - validate config files - don't fail instantly if we fail to exec or chdir; instead, wait for input to avoid restart loops - have ed restart on JOIN rather than instantly - output stderr to the channel as well
Diffstat (limited to 'fifo.lua')
-rw-r--r-- | fifo.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fifo.lua b/fifo.lua index 03a7af7..f3a3d10 100644 --- a/fifo.lua +++ b/fifo.lua @@ -11,7 +11,7 @@ function fifo.signal(f) end function fifo.get(f) - if not f.head then + while not f.head do f.cond:wait() end @@ -21,7 +21,13 @@ function fifo.get(f) end function fifo.put(f, data) - f.head = { data = data, tail = f.head } + local tail = f.head + while tail and tail.tail do tail = tail.tail end + if tail then + tail.tail = { data = data } + else + f.head = { data = data } + end fifo.signal(f) end |