Different behavior of repl & julia for watching directory when receiving interrupting signal

If I observe a directory for changes but send a signal to interrupt the script before any changes happen I got an unhandled error message. This is not the case using the code in the REPL or if there was a change in directory before.

So what I’m doing wrong here? Thx for answers and hints as always.

Here are the code lines (sorry I dont see how to format the code lines nicely):

#handle interruption - not needed in REPL
ccall(:jl_exit_on_sigint, Void, (Cint,), 0)

#directory to observe
dir = “/path_to_dir/”

while true

try w = watch_file(dir,-1)
    if w.changed
catch x
    return error("Recieved interupting signal while watching $dir")


How I said, if any change happens before the interrupting signal comes all works fine.
Otherwise I got this error:

ERROR (unhandled task failure): InterruptException:
[1] process_events at ./libuv.jl:82 [inlined]
[2] wait() at ./event.jl:216
[3] wait(::Condition) at ./event.jl:27
[4] macro expansion at ./distributed/remotecall.jl:230 [inlined]
[5] (::Base.Distributed.##131#132)() at ./event.jl:73

and the script is still running.

Using julia v0.6.2

Huuhuu, tock tock :wink:

No hints nor explanations?

Can someone confirm that behavior?
Should I open a bug in github?
Or is this an user fault?

Thx for reading & answering.

This behavior is not present at julia version 0.7.0-rc2.