1
0
mirror of https://github.com/janet-lang/janet synced 2025-09-13 00:06:06 +00:00

Add more cases for checking coerce error.

Channel operations inside a janet_call could wreak more
havoc later, when scheduled fibers are shooting off when they shouldn't
be. The easiest way to prevent this is simply check that we are not
inside janet_call before doing channel operations. We also get nicer
error messages this way.
This commit is contained in:
Calvin Rose
2025-02-16 10:31:34 -06:00
parent 2e6001316a
commit 3441bcbd69
4 changed files with 28 additions and 0 deletions

View File

@@ -482,6 +482,14 @@
(:close chat-server)
# Issue #1531
(defn sleep-print [x] (ev/sleep 0) (print x))
(protect (with-dyns [*out* sleep-print] (prin :foo)))
(defn level-trigger-handling [conn &] (:close conn))
(def s (assert (net/server test-host test-port level-trigger-handling)))
(def c (assert (net/connect test-host test-port)))
(:close s)
# Issue #1531 no. 2
(def c (ev/chan 0))
(ev/spawn (while (def x (ev/take c))))
(defn print-to-chan [x] (ev/give c x))