How to make edts-shell load my project ebin and app.config?
edts-shell does not load my project ebin and app.config. It cannot access my otp project. Would you tell me what I'm doing wrong?
From a terminal I can start the shell,
erl -pa ebin debs/*/ebin -config app
followed with gani:start().
but from the edts-shell, gani:start/0 is undefined.
$ cat .edts
:name "gani"
:node-sname "sgani"
:lib-dirs '("src" "deps")
:app-include-dirs '("include")
:otp-path "/usr/local/bin/"
:start-command "erl -sname sgani -pa ebin debs/*/ebin -config app"
I found that using M-x edts-shell begins an erl shell with ebin files loaded -gani:start/2 is defined and is auto suggested by edts but the app.config definitions aren't available to the environment. Dependency modules aren't defined in the edts-shell either.
I'm getting closer.
There are currently three options for running edts project nodes. The default is to just bring up an erlang node with the correct path set up, but nothing else. This works fine for running xref and unit tests (unit tests should ideally set up and restore their own required system state, IMHO).
If there's already a running node with the same name, EDTS will connect to that node instead of starting its own. This means that you can start your own node from a separate terminal if you like.
The third option is to specify a start script that EDTS should run in order to initialize your node. That way you can ensure you get a complete system up-and-running. Have a look at the start-command parameter in the README
(defun edts-shell (&optional pwd switch-to)
"Start an interactive erlang shell."
(interactive '(nil t))
(edts-api-ensure-server-started)
(let*((buffer-name (format "*edts[%s]*" edts-shell-next-shell-id))
(node-name (format "edts-%s" edts-shell-next-shell-id))
(command (list edts-erl-command "-sname" node-name
"-config"
"/home/duko/Software/gani/app"
))
I found the edts-shell command didn't use the arguments in :start-command. Hardcoding the config in edts-shell worked for me.
I'd like to contribute a long-term solution for this. Feel free to give instruction.
I did try starting a node from the shell and edts did connect to that node -the shell in the original node would respond to the edts node, but for whatever reason the config file was not available in edts' shell.
TJ,
This appears to be a non-issue. I misunderstood the :start-command option, but see now that you wrote 'specify a start script' with :start-command.
Its not obvious the :start-command works this way and I didn't realise it would not use modifiers.
Well, it should obviously take parameters. If that doesn't work, then it's a bug :/
I tried and can't reproduce the failure. I think that the misunderstanding may be that the edts-shell command is not actually connected to any project. Ie. M-x edts-shell RET will just start a shell, equivalent to running erl on the command line.
I think I'm finding myself wanting to do the same thing. How may one use the launch command that's in the .edts ?
Generally edts sounds pretty cool but it's hard to figure out a workflow with it once it's installed. A little bit of doc would go a long way. I'm still trying to figure out how spawn the erlang vm with the right launch command / script, connecting edts, using the debugger etc ..
@mtourne The start command is just run as a shell command in the root of your project.
please reopen if still an issue