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
Yesterday I was trying to use Revise.entr to force live code reloading for web server development and became greatly confused because entr just seems to work inconsistently with the REPL-triggered Revise event loop.
Here's a MWE in which there's a file foo.jl containing a trivial function foo() which I'd like to revise. I expected that calling includet("foo.jl") at the top would automatically keep the function foo() up to date in the entr callback, like it does in the REPL. However
using Revise
open("foo.jl", write=true) do io
write(io, "foo() = 0")
endincludet("foo.jl")
@syncbegin# Simulate the user asynchronously modifying file foo 5 times@asyncfor i=1:5sleep(1)
open("foo.jl", write=true) do io
write(io, "foo() = $i")
endendentr(["foo.jl"]) do# I'd expect foo() to be already up to date once execution reaches this# point.@show Base.invokelatest(foo)
# Press Ctrl-C to exit ...endend
The output:
julia> include("foo_test.jl")
Base.invokelatest(foo) = 0 # should be 1
Base.invokelatest(foo) = 0 # should be 2
Base.invokelatest(foo) = 0 # etc
Base.invokelatest(foo) = 0
Base.invokelatest(foo) = 0
Base.invokelatest(foo) = 0
^C
Another thing I noticed - getting back into the REPL after running the entr() loop, the revision of foo() is now broken in the REPL as well.
@ffevotte I think this change was introduced by the callback rewrite #488 as pinning Revise to the version v2.6.7 before that was merged makes this example behave as I expect, but v2.7.0 does not.
@clarkevans this may affect you, as I was taking inspiration from your example code in JuliaWeb/HTTP.jl#587 when I hit this issue.
The text was updated successfully, but these errors were encountered:
c42f
changed the title
Individual tracked files not revised with entr
Individual tracked files not revised with Revise.entrNov 18, 2020
c42f
changed the title
Individual tracked files not revised with Revise.entr
Individual tracked files not revised with entrNov 18, 2020
Ok, the problem here is that add_callback() calls init_watching with no pkgdata, so the id of the files which are now watched by the callback gets set unconditionally to NOPACKAGE. In turn, this breaks revision of any of these files which were already being revised, because the id check in revise_dir_queued fails and it no longer adds them to the revision queue at:
Yesterday I was trying to use
Revise.entr
to force live code reloading for web server development and became greatly confused becauseentr
just seems to work inconsistently with the REPL-triggered Revise event loop.Here's a MWE in which there's a file
foo.jl
containing a trivial functionfoo()
which I'd like to revise. I expected that callingincludet("foo.jl")
at the top would automatically keep the functionfoo()
up to date in theentr
callback, like it does in the REPL. HoweverThe output:
Another thing I noticed - getting back into the REPL after running the
entr()
loop, the revision offoo()
is now broken in the REPL as well.@ffevotte I think this change was introduced by the callback rewrite #488 as pinning Revise to the version v2.6.7 before that was merged makes this example behave as I expect, but v2.7.0 does not.
@clarkevans this may affect you, as I was taking inspiration from your example code in JuliaWeb/HTTP.jl#587 when I hit this issue.
The text was updated successfully, but these errors were encountered: