Skip to content

Commit

Permalink
Merge pull request #75 from iblis17/ib/freebsd
Browse files Browse the repository at this point in the history
implement revise_file_queued for FreeBSD
  • Loading branch information
timholy authored Jan 31, 2018
2 parents 235f76e + a42d069 commit 9f8e862
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/Revise.jl
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ function process_parsed_files(files)
haskey(watched_files, dir) || (watched_files[dir] = WatchList())
push!(watched_files[dir], basename)
push!(udirs, dir)

@static if Sys.KERNEL == :FreeBSD
@schedule revise_file_queued(file)
end
end
for dir in udirs
updatetime!(watched_files[dir])
Expand All @@ -158,6 +162,23 @@ function revise_dir_queued(dirname)
@schedule revise_dir_queued(dirname)
end

# Require by FreeBSD.
# Because the behaviour of `watch_file` is different on FreeBSD.
# See #66.
function revise_file_queued(file)
if !isfile(file)
sleep(0.1) # in case git has done a delete/replace cycle
if !isfile(file)
@warn "$file is not an existing file, Revise is not watching"
return nothing
end
end

watch_file(file) # will block here until the file changes
push!(revision_queue, file)
@schedule revise_file_queued(file)
end

function revise_file_now(file)
if !haskey(file2modules, file)
println("Revise is currently tracking the following files: ", keys(file2modules))
Expand Down

0 comments on commit 9f8e862

Please sign in to comment.