DaemonMode.jl icon indicating copy to clipboard operation
DaemonMode.jl copied to clipboard

interruption with CTRL-C

Open dpinol opened this issue 4 years ago • 2 comments

Hi, I use DaemonMode to run my unit tests. If I interrupt the execution with CTRL-C, the client aborts but the server sometimes continues running the tests. Is there any way to abort them?

I tried this, but I'm not even able to get into the "catch" to detect when the daemon execution should be aborted

        Base.exit_on_sigint(false)
        try
            runargs()
        catch e
            println(\"crashed\")
        end

thanks

dpinol avatar Sep 18 '21 16:09 dpinol

I faced this also in https://github.com/c42f/RemoteREPL.jl/issues/16, and implemented a partial solution there for remote processes in https://github.com/c42f/RemoteREPL.jl/pull/24

However, in general having CTRL-C handling as capable as the normal Julia REPL is a hard problem which (a) requires an entirely separate supervisor process and (b) if implemented with SIGINT, could kill a Task which is unrelated to the tests you're trying to run. (For example, if you're running two separate sets of tests within the same daemonmode process.)

For DeamonMode.jl a full solution would be possible with a supervisor and persistent worker processes. (As an in-process async server, RemoteREPL can't easily take this same approach.)

c42f avatar May 27 '22 02:05 c42f

On Windows, running julia with --handle-signals=no makes the daemon stoppable with ^C (I think the shell just simply terminate the process). Otherwise julia will hang when terminated with ^C.

char101 avatar Mar 12 '24 15:03 char101