in reply to Win32 signals between parent/child

kill doesn't work the same on win32. See the entry in perlport.


TGI says moo

Replies are listed 'Best First'.
Re^2: Win32 signals between parent/child
by jrsimmon (Hermit) on Aug 31, 2007 at 14:31 UTC
    Ok, that explains that. Is there a recommended alternative for simple parent/child communication? I had hoped to avoid using sockets, but I'm not seeing any other alternatives...

      As I pointed out above, the first problem with your OP code is that 'INT' is not defined anywhere, so your attempt to kill INT, $pid; is just a syntax error.

      Are you looking for a win32-only solution or must it be cross platform.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        Win32 only. The two options I know of are socketpair and a file-based semaphore implementation. I'm hoping for something that is simpler than the former, but not quite so brute-force-ish as the latter.
        I've replaced the line
        kill INT, $pid;
        with this line
        kill 2, $pid;
        I also added use strict to make sure everything else was correct, and the script now runs with no errors.
        This does not, however, solve the problem. Per a previous post, kill() was not completely ported to win32. I'm looking at alternatives, but so far all I've found is socketpair. This is a bit heavier than I had hoped for. The script is for win32 only. If you have any suggestions for alternatives, I would love to hear them.