diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 6837059f..32db2d0c 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -3583,16 +3583,18 @@ (,ev/deadline ,deadline nil ,f) (,resume ,f)))) - (defn- cancel-all [fibers reason] (each f fibers (if (fiber/can-resume? f) (ev/cancel f reason)))) + (defn- cancel-all [fibers reason] (each f fibers (ev/cancel f reason) (put fibers f nil))) (defn- wait-for-fibers [chan fibers] (defer (cancel-all fibers "parent canceled") (repeat (length fibers) (def [sig fiber] (ev/take chan)) - (unless (= sig :ok) - (cancel-all fibers "sibling canceled") - (propagate (fiber/last-value fiber) fiber))))) + (if (= sig :ok) + (put fibers fiber nil) + (do + (cancel-all fibers "sibling canceled") + (propagate (fiber/last-value fiber) fiber)))))) (defmacro ev/gather `` @@ -3600,13 +3602,16 @@ Returns the gathered results in an array. `` [& bodies] - (with-syms [chan res] + (with-syms [chan res fset ftemp] ~(do + (def ,fset @{}) (def ,chan (,ev/chan)) (def ,res @[]) - (,wait-for-fibers ,chan - ,(seq [[i body] :pairs bodies] - ~(,ev/go (fn [] (put ,res ,i ,body)) nil ,chan))) + ,;(seq [[i body] :pairs bodies] + ~(do + (def ,ftemp (,ev/go (fn [] (put ,res ,i ,body)) nil ,chan)) + (,put ,fset ,ftemp ,ftemp))) + (,wait-for-fibers ,chan ,fset) ,res)))) (compwhen (dyn 'net/listen) diff --git a/src/mainclient/shell.c b/src/mainclient/shell.c index 1e0bdc33..c1812d75 100644 --- a/src/mainclient/shell.c +++ b/src/mainclient/shell.c @@ -955,6 +955,7 @@ static int line() { break; #ifndef _WIN32 case 26: /* ctrl-z */ + clearlines(); norawmode(); kill(getpid(), SIGSTOP); rawmode();