in reply to Simple way to find on Windows, whether a process is running

From the perlport manpage you referenced:

As in Unix, if $sig is 0 and the specified process exists, it returns true without actually terminating it. (Win32)

And from experience, kill 0, $pid works fine. It doesn't do it using signals, but the emulation is good.


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.

Replies are listed 'Best First'.
Re^2: Simple way to find on Windows, whether a process is running
by rovf (Priest) on Sep 09, 2011 at 14:34 UTC

    At least on Windows 7, this is not true anymore. I tried it with various PIDS - no matter, whether the process exists or not, kill always returned true :-( However, this is Perl 5.8.8. This Perl was implemented before Windows 7, so it could be that a newer Perl version has a better "kill".

    -- 
    Ronald Fischer <ynnor@mm.st>

      From the Active State change log:

      Bug Fixes and Changes since build 821

      ...

      kill(0, $pid) was always returning TRUE in build 820 on Windows. It now returning the correct values again (bug 67519).

      Upgrade. Works okay on AS 5.8.9:

      c:\test>\perl32\bin\perl -le"print $]; print kill 0, $_ for 3844, 4844 +" 5.008009 1 0

      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.
        Upgrade. Works okay on AS 5.8.9
        I'm not sure whether I'll get permission to upgrade (and in this case, I would go straight to 5.12 anyway).

        Any suggestions how to solve it within 5.8.8?

        -- 
        Ronald Fischer <ynnor@mm.st>