It would be good for this to be an option (if it isn't already), but I wouldn't personally default it to 'on'. There are analogous things in cljs that are on by default in some scenarios and it's weird and distracting.
I haven't used lein projects in a while and trying to jack in on an empty project I'm getting an error when the lein command adds -- update-in :jvm-opts conj -Djdk.attach.allowAttachSelf -- .
If I M-x C-u cider-jack-in edit the command and remove it so it runs :
/home/jmonetta/bin/lein update-in :dependencies conj \[nrepl/nrepl\ \"1.3.0-beta2\"\] -- update-in :dependencies conj \[refactor-nrepl/refactor-nrepl\ \"3.10.0\"\] -- update-in :plugins conj \[refactor-nrepl/refactor-nrepl\ \"3.10.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.49.0\"\] -- with-profile +dev repl :headless :host ::
then it works, but when it runs the default command :
/home/jmonetta/bin/lein update-in :dependencies conj \[nrepl/nrepl\ \"1.3.0-beta2\"\] -- update-in :dependencies conj \[refactor-nrepl/refactor-nrepl\ \"3.10.0\"\] -- update-in :plugins conj \[refactor-nrepl/refactor-nrepl\ \"3.10.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.49.0\"\] -- update-in :jvm-opts conj -Djdk.attach.allowAttachSelf -- with-profile +dev repl :headless :host ::
then it fails with :
Error encountered performing task 'repl' with profile(s): 'base,system,user,provided,dev'
java.lang.IllegalArgumentException: array element type mismatch
Any ideas?Lein version is Leiningen 2.11.1 on Java 17.0.12-ea OpenJDK 64-Bit Server VM
oh, I see quoting the property like -- update-in :jvm-opts conj '"-Djdk.attach.allowAttachSelf"' -- seams to fix it
changing it like this makes it work
but not sure how this affect other OSs
I suppose it might be shell-dependent. Which one do you use?
zsh
but I get the same issue running that command on bash
I mean, without quoting
Interesting. It's weird that you are the first person to run into this
Is that the stable CIDER that you are using?
I'm on CIDER 1.15.0-snapshot (package: 20240603.825)
I would ask you to update to the latest one before debugging this further
I will, but since on master I see cider-enable-nrepl-jvmti-agent being nil by default, and I have it customized on t maybe that is why not many people complained ?
Oh, damn, you are right. I thought it was on by default
I could also reproduce with the latest cider CIDER 1.15.1 (Cogne)
Thanks for verifying! It works for me on Fish though
I wonder why this would have to be quoted, looks like a shell-friendly string to me
yeah, that quoting thing is tricky
I guess it is about the jvm-opts vector requiring Clojure strings, and this goes like a symbol?
Doesn't seem so. I can run that command from the terminal, both Fish, Bash, and ZSH, and it works everywhere
Does it work when you run that from the terminal (without the extra quotes)?
no, I tried zsh and bash
Fails with the same error in the terminal?
yeah like this :
I can reproduce now
with fish?
Everywhere. It seems to be the exact command that's faulty
great, at least it is consistent
probably for windows it has to be different quoting? no idea, I don't have a windows setup
This is fun
If you add trampoline in front of repl, it works
interesting
Why would my CIDER inject trampoline and yours not, I wonder
Because of cider-lein-parameters, obviously
it doesn't work for me, adding trampoline in front of repl on that same command
Same error still?
no
Must be something with your setup that prevents trampoline REPL from starting. But, to be honest, I no longer have idea what that trampoline thing does. I think it was something about killing the original Lein process and leaving only one running
yeah it was about leaving one JVM instead of two
Anyway, you seem to be right that Leiningen treats the unquoted string as symbol and that's why it breaks. I guess we need to quote it, but I'm not sure if it wouldn't break somewhere else. Maybe @bozhidar can chime in?
and there is also the Windows case, which is probably different
I’m on the road for the next week, so I can’t really check much. Off the top of my head, nothing comes to mind. I’m guessing when we can just expose the configuration option in Leiningen, so this wouldn’t need to be part of the shell command. But it will obviously require a PR in Lein.
I'll ask in #leiningen to see if I can extract some knowledge from there
I also remember @vemv mentioning that modifying :jvm-opts from shell is tricky, that was probably it
I think Enrich (not in use in this thread, I guess) uses that style of quoting and nobody has complained so it would seem a safe change