-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capture SIGINT with @async, in a script or in the REPL #45055
Comments
Just coming to say I'm bumping into the same issue. I'm running multiple AWS.jl calls in an
|
With just released 1.10.0, this issue is gone in the REPL, but persists in scripting. |
Reproducible on the master branch. Changing the
function try_interrupt()
@sync while true
br = try
sleep(1)
println("trying...")
Threads.@spawn 1+1
false
catch e
if typeof(e) <: InterruptException
println("caught Interrupt")
true
else
false
end
end::Bool
br && break
end
end
try_interrupt() Results in:
|
This is still an issue? julia> function try_interrupt()
while true
try
sleep(1)
println("trying...")
@async 1+1
catch e
if typeof(e) <: InterruptException
println("caught Interrupt")
return
end
end
end
return
end
try_interrupt (generic function with 1 method)
julia> try_interrupt()
trying...
trying...
caught Interrupt
julia>
|
Define this function in REPL:
In Julia 1.7.2, everything works:
But in 1.9.0 it does not work:
In another word, issue #19467 comes back.
If I put the code in a script
file.jl
, then run it withjulia -i file.jl
orjulia -e 'include(popfirst!(ARGS))' file.jl
,then both 1.7.2 and 1.9.0 returns fatal error when attempt to interrupt with Ctrl-C:
fatal: error thrown and no exception handler available.
Note: using
Base.exit_on_sigint(false)
does not solve this issueThe text was updated successfully, but these errors were encountered: