diff options
| author | 2026-02-15 21:54:42 -0600 | |
|---|---|---|
| committer | 2026-02-15 21:54:42 -0600 | |
| commit | 1557f9da7817bea8021b57bf53c7539aac73e6e7 (patch) | |
| tree | 1b570655abb5b1aece9bea9d42facdb1f0f9c758 | |
| parent | Improve ability to load modules by full path. (diff) | |
Don't reference argv after fiber may have been resized.
| -rw-r--r-- | src/boot/boot.janet | 3 | ||||
| -rw-r--r-- | src/core/corelib.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 7296e9cc..e28ec5ce 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -2932,7 +2932,8 @@ (defn module/add-file-extension ``` Add paths to `module/paths` for a given file extension such that - the programmer can import a module by relative or absolute path. + the programmer can import a module by relative or absolute path from + the current working directory. Returns the modified `module/paths`. ``` [ext loader] diff --git a/src/core/corelib.c b/src/core/corelib.c index 5083b948..e420b736 100644 --- a/src/core/corelib.c +++ b/src/core/corelib.c @@ -295,6 +295,7 @@ JANET_CORE_FN(janet_core_native, "from the native module.") { JanetModule init; janet_arity(argc, 1, 2); + Janet argv0 = argv[0]; const uint8_t *path = janet_getstring(argv, 0); const uint8_t *error = NULL; JanetTable *env; @@ -310,7 +311,7 @@ JANET_CORE_FN(janet_core_native, /* GC root incase garbage collection called inside module entry */ janet_fiber_push(janet_vm.fiber, janet_wrap_table(env)); init(env); - janet_table_put(env, janet_ckeywordv("native"), argv[0]); + janet_table_put(env, janet_ckeywordv("native"), argv0); return janet_wrap_table(env); } |
