in reply to Re: Need a reliable way to send SIGINT to a perl process on 5.8.8/windows XPpro
in thread Need a reliable way to send SIGINT to a perl process on 5.8.8/windows XPpro

I'm not surprised that $console->GenerateCtrlEvent(); doesn't affect the child process.

According to the documentation for the underlying function (GenerateConsoleCtrlEvent), the signal is generated in all processes that share the console of the calling process when the process group id parameter is 0 like it is here. (If the parameter is not zero, all the processes in the specified process group are affected.) The child should be affected, meaning its event handler should be called if one was set.

By the way, this function can be called as a static method: Win32::Console->GenerateCtrlEvent();. It's not really a console method at all.

  • Comment on Re^2: Need a reliable way to send SIGINT to a perl process on 5.8.8/windows XPpro
  • Download Code

Replies are listed 'Best First'.
Re^3: Need a reliable way to send SIGINT to a perl process on 5.8.8/windows XPpro
by BrowserUk (Patriarch) on Mar 09, 2007 at 10:25 UTC
      The way I read the OP, the problem is not sending the Ctrl-C or its effect on the child, the problem is to avoid killing the parent along with the child. According to the OP, setting $SIG{INT} to "IGNORE" used to accomplish that task in 5.6.1, but it doesn't anymore. That's what I addressed in my top level post. Do you see it differently? The OP wasn't all that clear.
Re^3: Need a reliable way to send SIGINT to a perl process on 5.8.8/windows XPpro
by fwashbur (Sexton) on Mar 09, 2007 at 21:16 UTC
    The behavior we see on 5.6.1 matches the documentation, but on 5.8.8 it does not appear that the CTRL-C get through to the child process where we have the $SIG{INT} handler defined. I have tried using defaults which works on 5.6.1, and specifying CTRL_C_EVENT along with the pid directly and that doesn't seem to help either.