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

:init.restart() #45

Closed
josevalim opened this issue Jul 1, 2016 · 9 comments
Closed

:init.restart() #45

josevalim opened this issue Jul 1, 2016 · 9 comments

Comments

@josevalim
Copy link

I am not sure this is the best way to let you know but I have just found out there is a command called :init.restart() that will restart the whole system, shutting down all applications and starting them again. For example, if you do:

$ iex -S mix test
iex> :init.restart()

It will restart everything and run the tests again. Maybe this can be used to make this project much more straight-forward. :)

@josevalim
Copy link
Author

Related gist which may help you with further ideas: https://gist.github.com/josevalim/a5e747c90a72e40a4b52062ea6919877

@lpil
Copy link
Owner

lpil commented Jul 1, 2016

Gosh. Suddenly all that work seems a bit pointless. :P

Thanks for the info!

@josevalim
Copy link
Author

I think we still need the watching bit, just the restart bit that got much much easier! :D

@lpil
Copy link
Owner

lpil commented Jul 1, 2016

The watching is easy thanks to fs. :)

One of the features I want is having IEx running at the same time so that one can type expressions in the repl while the tests are not running. If we use :init.restart/0 we'll lose the state each time the tests run. :(

@josevalim
Copy link
Author

If we use :init.restart/0 we'll lose the state each time the tests run. :(

Yes :(

@lpil
Copy link
Owner

lpil commented Jul 1, 2016

Perhaps we can support both once we get test modules closing after an exception is thrown when compiling them. (keen to take a stab at this myself, but have had a busy week)

There are advantages to each method. The init one wipes clean all state and works for versions of Elixir that don't have the test module closing, the other one gives us the repl and might be a touch faster (?).

@josevalim
Copy link
Author

Yeah, it may be faster with the risk of potentially running on outdated state.

@lpil
Copy link
Owner

lpil commented Jul 1, 2016

Yes I think people have had problems with state in Phoenix applications already. I need to find some time to read the rebar3 autotest plugin so I can see how it is managed there. It re-uses the VM and features a repl.

@lpil
Copy link
Owner

lpil commented Jan 29, 2017

Closing as --listen-on-stdin exists now

@lpil lpil closed this as completed Jan 29, 2017
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