So if I run this to re-include a file when it changes:
fname = "/full/path/to/changingfile.jl"
t1 = 0
while(true)
if t1 != mtime(fname)
println(isfile(fname))
include(abspath(fname))
t1 = mtime(fname)
end
Foo("a")
end
And the changingfile.jl is actually changed I get could not open file. Just wanted to know if this is normal behaviour? It does not happen when it’s inside either an if or it is just a loop.
I was impressed by Django server reloading the files I’m working on so decided to implement it in my Julia server( at least not in production ).
Some editors back buffer their writes — write to a temp file, unlink the existing file inode, then rename the temp file. To avoid file corruption I think. Since you are basically polling the file constantly, if your editor does this then the file might not exist for a brief moment exactly when you are looking for it.