diff --git a/libinterp/corefcn/utils.cc b/libinterp/corefcn/utils.cc --- a/libinterp/corefcn/utils.cc +++ b/libinterp/corefcn/utils.cc @@ -1262,6 +1262,10 @@ { if (seconds > 0) { +#if defined (__WIN32__) + BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; +#endif + double t; unsigned int usec @@ -1277,7 +1281,11 @@ octave_sleep (sec); octave_usleep (usec); +#if defined (__WIN32__) + END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; +#else octave_quit (); +#endif } } diff --git a/libinterp/corefcn/toplev.cc b/libinterp/corefcn/toplev.cc --- a/libinterp/corefcn/toplev.cc +++ b/libinterp/corefcn/toplev.cc @@ -1037,6 +1037,7 @@ } else retval(0) = pid; + #elif defined (__WIN32__) STARTUPINFO si; PROCESS_INFORMATION pi; @@ -1058,9 +1059,21 @@ #endif } else if (return_output) - retval = run_command_and_return_output (cmd_str); + { +#if defined (__WIN32__) + BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; +#endif + retval = run_command_and_return_output (cmd_str); + +#if defined (__WIN32__) + END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; +#endif + } else { +#if defined (__WIN32__) + BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; +#endif int status = system (cmd_str.c_str ()); // The value in status is as returned by waitpid. If @@ -1072,6 +1085,10 @@ status = octave_wait::exitstatus (status); retval(0) = status; + +#if defined (__WIN32__) + END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; +#endif } } else