On Sun, 11 May 2025 10:58:18 -0700 Henrik Bengtsson <henrik.bengts...@gmail.com> wrote:
> Is it possible to gracefully interrupt a child R process on MS > Windows, e.g. a PSOCK cluster node? Not in the general case (I think, based on the code paths leading to Rf_onintr() on Windows), but PSOCK cluster nodes are instances of Rscript.exe running the terminal front-end, and the terminal front-end interrupts R upon receipt of Ctrl+C and Ctrl+Break console events: https://learn.microsoft.com/en-us/windows/console/setconsolectrlhandler This makes it possible for ps::ps_interrupt() to spawn a child process to attach to the console where Rscript.exe is running and generate this event: https://github.com/r-lib/ps/blob/042d4836ac584c95a59985171fdfa3b6baf2fa6c/src/interrupt.c#L33-L35 This probably needs specially written code in the children that expects to be interrupted in order to work reliably, but interrupting the children and then interrupting the parent and submitting another job to the PSOCK cluster seems to have worked for me on R-4.5.0. -- Best regards, Ivan ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel