mirror of
https://github.com/janet-lang/janet
synced 2025-10-24 04:07:41 +00:00
Prevent await inside janet_call - address #1531
This was partially implemented before, but not in the case where the await or other signal itself was created by a C function. We have to separate code paths for generating signals - one via normal returns in janet_vm_continue, and the other via longjump. This adds handling for the longjump case, as well as improved messaging.
This commit is contained in:
@@ -465,4 +465,13 @@
|
||||
# Close chat server
|
||||
(:close chat-server)
|
||||
|
||||
# Issue #1531
|
||||
(def c (ev/chan 0))
|
||||
(ev/spawn (while (def x (ev/take c))))
|
||||
(defn print-to-chan [x] (ev/give c x))
|
||||
(assert-error "coerce await inside janet_call to error"
|
||||
(with-dyns [*out* print-to-chan]
|
||||
(pp :foo)))
|
||||
(ev/chan-close c)
|
||||
|
||||
(end-suite)
|
||||
|
||||
Reference in New Issue
Block a user