Fork me on GitHub
#clj-on-windows
<
2023-05-04
>
jjttjj13:05:14

Not sure the best place to ask this, but using the new add-libs on windows I seem to keep getting the dreaded CreateProcess error=206, The filename or extension is too long error. It happens even when adding the same deps to my deps.edn file and restarting my repl works fine. Is anyone else hitting this? Is there a way to debug the CLI command being ran?

borkdude13:05:33

@U064UGEUQ I've done an experiment here by re-binding the invoke-tool var (which is an intentional use of that): https://github.com/borkdude/lein.repl.deps

borkdude13:05:13

This code is not coupled to lein at all, but it would enable you to use add-libs in leiningen without installing the CLI. Playing around with that code might give you some ideas

borkdude13:05:04

It might still have the same issue as you encountered though. The issue is that Windows has a certain limit on the argument length and if your classpath gets really long that's a problem. There is an ask issue for this though. It could be solved easily on Java 9+

jjttjj13:05:39

Cool I'll try playing with that at some point. You mean this ask question right? https://ask.clojure.org/index.php/7864/windows-version-tools-deps-fails-launch-java-classpath-long So the idea would be to rebind invoke tool to use a "pathing jar" as described there to keep the command short

borkdude13:05:14

I think I could fix this in deps.clj but I don't want to get too far ahead of the official CLI

borkdude14:05:13

The change would be here: https://github.com/borkdude/deps.clj/blob/2f93fe8ba712c855feb6ecf26d2ed70646b34356/src/borkdude/deps.clj#L872 The solution would be to first write the classpath to a temp-file and then use --classpath @file

jjttjj14:05:14

Oh yeah thanks. I've definitely hit this before prior to the new add-libs things but usually it works for me to just set my mvn/local-repo to /r. I wasn't sure of the nature of it yet relating to add-libs though, curious if there might be a way to get the command string length more in line with the normal clj one. I've just been hitting this with one medium sized project though. The --classpath option seems pretty straightforward to get working for a custom invoke tool though

borkdude14:05:41

The issue with fixing this is compatibility with java 8. So you'd have to probe java --version or just try it and if it fails go back to the old behavior, or do it through an explicit setting or env var or so: DEPS_CLJ_USE_CP_FILE_ARGUMENT=true

Alex Miller (Clojure team)14:05:12

I actually think the issue in add-lib might not be just that but the large arguments we pass, so not sure just the classpath thing is enough

Alex Miller (Clojure team)14:05:22

which is to say, ask clojure question is welcome :)

👍 2
borkdude14:05:39

The whole basis is serialized through a CLI arg?

Alex Miller (Clojure team)14:05:59

well, not the whole basis, but significant portion

Alex Miller (Clojure team)14:05:29

it's in my queue, will definitely be working on this for next alpha

🙏 3
borkdude09:05:44

I've released a new deps.clj which at least solves one "too long file argument" problem when passing a long classpath. Try scoop install clj-deps from the scoop-clojure by @UBLU3FQRZ

borkdude10:05:15

It might not solve the add-lib problem yet as the whole basis is passed via a CLI argument. I think Alex is working on improving this by passing it via a file or so.