You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When watching multiple files with entr, and the user-provided function throws an error, entr does not immediately exit as I think it is intended to.
Steps to reproduce:
julia>import Revise
julia>import Dates
# Create two empty files
julia>open((f)->nothing, "/tmp/file1", "w")
julia>open((f)->nothing, "/tmp/file2", "w")
#... and watch them
julia> Revise.entr(["/tmp/file1", "/tmp/file2"]; postpone=true) doprintln("Something changed: ", Dates.now())
error("KO")
end# Touch file1 from outside julia# -> the user-provided function runs
Something changed:2020-05-16T13:13:37.046# -> the error has been thrown, but nothing seems to happen yet# -> entr does not return# Touch file1 again# -> nothing happens; the user-provided function is not called# Later touch file2
Something changed:2020-05-16T13:14:00.926# -> now the errors are shown and `entr` exits
ERROR: TaskFailedException:
KO
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] (::var"#9#10")() at ./REPL[5]:3
[3] #invokelatest#1 at ./essentials.jl:712 [inlined]
[4] invokelatest at ./essentials.jl:711 [inlined]
[5] macro expansion at /home/francois/.julia/packages/Revise/AMRie/src/Revise.jl:828 [inlined]
[6] (::Revise.var"#81#82"{Float64,var"#9#10",typeof(FileWatching.watch_file),String})() at ./task.jl:358...and 1 more exception(s).
I think this happens because one @async task is spawned for each watched file, and the try...catch block handling exception surrounds an @sync block synchronizing all these tasks. So that when an error is thrown in one of the @async tasks, nothing happens until all other tasks terminate one way or another.
I'm working on a (tentative) fix, and should be able to propose a PR in the coming hours...
The text was updated successfully, but these errors were encountered:
ffevotte
added a commit
to ffevotte/Revise.jl
that referenced
this issue
May 16, 2020
When watching multiple files with
entr
, and the user-provided function throws an error,entr
does not immediately exit as I think it is intended to.Steps to reproduce:
I think this happens because one
@async
task is spawned for each watched file, and thetry...catch
block handling exception surrounds an@sync
block synchronizing all these tasks. So that when an error is thrown in one of the@async
tasks, nothing happens until all other tasks terminate one way or another.I'm working on a (tentative) fix, and should be able to propose a PR in the coming hours...
The text was updated successfully, but these errors were encountered: