Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jack-in process exited on main-opts "-e" option #2551

Open
lensgolda opened this issue May 8, 2024 · 4 comments
Open

Jack-in process exited on main-opts "-e" option #2551

lensgolda opened this issue May 8, 2024 · 4 comments

Comments

@lensgolda
Copy link

Cheers!

;; deps.edn dev alias
{:dev {:extra-paths ["dev"]
       :extra-deps {integrant/repl {:mvn/version "0.3.3"}
                    hashp/hashp {:mvn/version "0.2.2"}}
       :main-opts ["-e" "(require,'hashp.core)(require,'user.my)"]}

my job project has this :dev alias with main-opts "-e" eval option, under the Git.
When i starting Calva Jack-in process, it exited with Status 0.

Connection log:

⚡️ Starting the REPL ⚡️ using the below command line:
(cd /Users/lens/dev/project; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.0.0"},cider/cider-nrepl {:mvn/version,"0.28.5"}}}' -M:dev:test)
...
# ;;some logs
07:56:45,417 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
07:56:45,417 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
...
Jack-in process exited. Status: 0

If i comment line with ;; :main-opts ["-e" "(require,'hashp.core)(require,'user.my)"] everything works fine (REPL starts).
If i comment line with ;; :main-opts ["-e" "(require,'hashp.core)(require,'user.my)"]and add connect sequence like so, everything also works fine:

"afterCLJReplJackInCode": "(require 'hashp.core) (require 'user.my) (in-ns 'user.my)",

The problem is i have to comment line each time starting a project, beacause i don't control deps.edn, and it coming from Git for me and i can't push changes like this to Git.
I have to revert changes in deps.edn each time.

Is there any way to leave deps.edn unchanged to Start Calva REPL this :dev alias, with or without this option

:main-opts ["-e" "(require,'hashp.core)(require,'user.my)"]

Best! Thanks!

@lensgolda
Copy link
Author

lensgolda commented May 8, 2024

VSCodium
Version: 1.88.1
Release: 24104
Commit: 0d01a72525276e5e3771fe5851b9c83de0de1e2b
Date: 2024-04-13T02:09:27.708Z
Electron: 28.2.8
ElectronBuildId: undefined
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Darwin x64 23.4.0

@PEZ
Copy link
Collaborator

PEZ commented May 8, 2024

Hi!

What may work is to define a :job-dev alias in your user deps.edn and then specify that alias in menuSelections.cljAliases of the connect sequence. If that doesn't work (not recalling whether Calva insists on that these aliases are defined in the project) there is also a setting calva.myCljAliases, but having that in your user settings may mess up your work with other projects...

Probably the best solution would be to agree with the team mates that :load-hashp should be its own alias.

Also, I may be missing something. Could be interesting to learn what your team mates do. Because it seems most people will be using nREPL and that :dev alias will be shutting the door to start the nREPL server via main-opts for them as well.

@lensgolda
Copy link
Author

i think it's because of main-opts in :dev alias and the way Calva starts nrepl

-M:dev:test ->|-m|<- nrepl.cmdline

and my :main-opts ["-e" "(require,'hashp.core)(require,'user.my)"] should or

  • somehow be "conjoined" to 👆 CLI command (-M:dev:test -m nrepl.cmdline -e "(require,'hashp.core)")
  • or :main-opts-key be removed
    and the last - works fine.

For some reasons, it works for my teammates without pain, beacause they mainly use Cursive or neovim, maybe beacause REPL starts for them another way, i don't know.

Anyway, the only one way i know it works like a charm - if i remove :main-opts-key at all, and, for example, add this code to eval under afterCLJReplJackInCode": "(require 'hashp.core) (require 'user.my)"

So if the best solution is to agree with the team mates, i will. There was a hope about another way.

Thanks!

P.S. i think you may close.

@PEZ
Copy link
Collaborator

PEZ commented May 9, 2024

Today Calva throws in the towel if the alias has a main opts. (It should inform/warn you about this in the alias select menu.) Maybe we could make that more sophisticated and merge if we can see that the main opts do not have a -m option and then merge the opts. Maybe that is what the other tools do, even.

Let's keep this issue open until we have figured out if we should fix anything.

Meanwhile, since you know what command line would fix it for you, I think you could leverage Jack-in custom command lines to dodge the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants