Skip to content

Commit

Permalink
Handle errors at a finer level in Revise.entr
Browse files Browse the repository at this point in the history
This stops all tasks watching individual files/directories when one of them
throws an error.

Fixes: timholygh-481
  • Loading branch information
ffevotte committed May 16, 2020
1 parent 8755d97 commit 0d86807
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/Revise.jl
Original file line number Diff line number Diff line change
Expand Up @@ -820,20 +820,24 @@ function entr(f::Function, files, modules=nothing; postpone=false, pause=0.02)
postpone || f()
for file in files
waitfor = isdir(file) ? watch_folder : watch_file
@async while active
ret = waitfor(file, 1)
if active && (ret.changed || ret.renamed)
sleep(pause)
revise()
Base.invokelatest(f)
@async try
while active
ret = waitfor(file, 1)
if active && (ret.changed || ret.renamed)
sleep(pause)
revise()
Base.invokelatest(f)
end
end
catch err
active = false
rethrow(err)
end
end
end
catch err
if isa(err, InterruptException)
active = false
else
active = false
if !isa(err, InterruptException)
rethrow(err)
end
end
Expand Down

0 comments on commit 0d86807

Please sign in to comment.