Ensure that watcher does not try to run a module that is not a koan
This commit is contained in:
@@ -4,8 +4,10 @@ defmodule Watcher do
|
||||
def callback(file, events) do
|
||||
if Enum.member?(events, :modified) do
|
||||
try do
|
||||
[{mod, _} | _] = Code.load_file(file)
|
||||
Runner.run(mod)
|
||||
Code.load_file(file)
|
||||
|> Enum.map(&(elem(&1, 0)))
|
||||
|> Enum.find(&Runner.koan?/1)
|
||||
|> Runner.run
|
||||
rescue
|
||||
e -> Display.show_compile_error(e)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user