elixir
elixir copied to clipboard
Infinite loop when compiling eex template
When compiling eex template with syntax error - missing do in if expression
<%= if @condition %>
<% else %>
<% end %>
the compiler hangs in infinite loop. The same happens with unless and for
Environment
- Elixir & Erlang versions (elixir --version): elixir 1.5.1, erlang 20.0.5
- Operating system: macOS 10.12.6
Current behavior
Infinite loop with 100% CPU usage outputting
warning: unexpected beginning of EEx tag "<%" on "<% else %>", please remove "" accordingly
web/templates/my_bad.html.eex:2
Expected behavior
No infinite loop Severity should be error
I've also experienced this, sucks when it brings down my dev server and I have to restart it because I forgot a do. ^.^;
This issue is really easy to reproduce on terminal
$ elixir -e 'EEx.eval_string ~S{
<% if true %>
foo
<% else %>
bar
<% end %>}'