I'm looking for a way to capture SIGINT in a julia script on a linux host, but I'm not able to understand how to manage signals.
In the REPL:
julia > try
sleep(1000)
catch e
@info "interrupt captured!"
end
Ctrl-C
[ Info: interrupt captured!
Instead, executing demo.jl:
try
sleep(1000)
catch e
@info "interrupt captured!"
end
gives:
terminal> julia demo.jl
Ctrl-C
signal (2): Interrupt
in expression starting at /tmp/demo.jl:3
epoll_pwait at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
uv__io_poll at /workspace/srcdir/libuv/src/unix/linux-core.c:270
uv_run at /workspace/srcdir/libuv/src/unix/core.c:359
jl_task_get_next at /buildworker/worker/package_linux64/build/src/partr.c:473
poptask at ./task.jl:704
wait at ./task.jl:712 [inlined]
...
How to manage the interrupt in this case?