1
0
mirror of https://github.com/janet-lang/janet synced 2024-06-25 22:53:16 +00:00

Require opt-in behavior per script.

This means a binscript needs to indicate that it is a Janet script, and
then the user who is installing the script can choose whether or not to
do the magic shebang replacement.
This commit is contained in:
Calvin Rose 2021-03-11 18:47:53 -06:00
parent 0d42506cde
commit 9eb4c59c04

4
jpm
View File

@ -1085,9 +1085,9 @@ int main(int argc, const char **argv) {
such that it will run correctly even when JANET_PATH is changed. if auto-shebang
is truthy, will also automatically insert a correct shebang line.
``
[&keys {:main main :hardcode-syspath hardcode :auto-shebang auto-shebang}]
[&keys {:main main :hardcode-syspath hardcode :is-janet is-janet}]
(def binpath (dyn :binpath JANET_BINPATH))
(def auto-shebang (or auto-shebang (dyn :auto-shebang)))
(def auto-shebang (and is-janet (dyn :auto-shebang)))
(if (or auto-shebang hardcode)
(let [syspath (dyn :modpath JANET_MODPATH)]
(def parts (peg/match path-splitter main))