diff libinterp/corefcn/interpreter.cc @ 29295:b73ddb964093

allow interrupts to be sent to all processes in process group or just octave * interpreter.h, interpreter.cc (interpreter::m_interrupt_all_in_process_group): New data member. (interpreter::interrupt_all_in_process_group): New functions. (interpreter::interrupt): Check m_interrupt_all_in_process_group option and send SIGINT to all processes in process group or just the current octave process.
author John W. Eaton <jwe@octave.org>
date Thu, 14 Jan 2021 01:15:45 -0500
parents 8784f20b9b8c
children 0231189f630d
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc	Thu Jan 14 01:11:44 2021 -0500
+++ b/libinterp/corefcn/interpreter.cc	Thu Jan 14 01:15:45 2021 -0500
@@ -477,6 +477,7 @@
       m_inhibit_startup_message (false),
       m_load_path_initialized (false),
       m_history_initialized (false),
+      m_interrupt_all_in_process_group (true),
       m_cancel_quit (false),
       m_executing_finish_script (false),
       m_executing_atexit (false),
@@ -1729,7 +1730,9 @@
     // signals to any subprocesses as well as interrupt execution of the
     // interpreter.
 
-    octave_kill_wrapper (0, sigint);
+    pid_t pid = m_interrupt_all_in_process_group ? 0 : octave_getpid_wrapper ();
+
+    octave_kill_wrapper (pid, sigint);
   }
 
   void interpreter::handle_exception (const execution_exception& ee)