1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-16 08:17:41 +00:00

Make os/execute cooperate with ev module.

os/execute, os/proc-wait do not block (currently posix only).
This uses the self-pipe trick to turn signals into a pollable entity.
This commit is contained in:
Calvin Rose
2020-11-29 15:36:21 -06:00
parent 7c8f5ef811
commit cbdea8f331
7 changed files with 252 additions and 47 deletions

View File

@@ -40,7 +40,7 @@
# or else the first read can fail. Might be a strange windows
# "bug", but needs further investigating. Otherwise, `build_win test`
# can sometimes fail on windows, leading to flaky testing.
(ev/sleep 0.2)
(ev/sleep 0.3)
(defn test-echo [msg]
(with [conn (net/connect "127.0.0.1" "8000")]
@@ -59,6 +59,7 @@
(var pipe-counter 0)
(def chan (ev/chan 10))
(let [[reader writer] (os/pipe)]
(ev/sleep 0.3)
(ev/spawn
(while (ev/read reader 3)
(++ pipe-counter))