mirror of
https://github.com/janet-lang/janet
synced 2024-11-28 11:09:54 +00:00
Fix #508 - nil fiber environment.
run-context did not handle a nil environment well, so that was fixed and ev/call inherits the environment when creating the fiber.
This commit is contained in:
parent
451340e4c0
commit
6c43489fb2
@ -2120,7 +2120,7 @@
|
||||
:parser parser
|
||||
:read read
|
||||
:expander expand} opts)
|
||||
(default env (fiber/getenv (fiber/current)))
|
||||
(default env (or (fiber/getenv (fiber/current)) @{}))
|
||||
(default chunks (fn [buf p] (getline "" buf env)))
|
||||
(default onstatus debug/stacktrace)
|
||||
(default on-compile-error bad-compile)
|
||||
|
@ -1684,6 +1684,7 @@ static Janet cfun_ev_call(int32_t argc, Janet *argv) {
|
||||
janet_arity(argc, 1, -1);
|
||||
JanetFunction *fn = janet_getfunction(argv, 0);
|
||||
JanetFiber *fiber = janet_fiber(fn, 64, argc - 1, argv + 1);
|
||||
fiber->env = janet_current_fiber()->env;
|
||||
if (NULL == fiber) janet_panicf("invalid arity to function %v", argv[0]);
|
||||
janet_schedule(fiber, janet_wrap_nil());
|
||||
return janet_wrap_fiber(fiber);
|
||||
|
Loading…
Reference in New Issue
Block a user