in reply to Re: kill a process with process name
in thread kill a process with process name

The actual script uses cmd in backticks `command 2>&1 >NUL` instead of exec. While replacing with system do I need to take care of anything?

Replies are listed 'Best First'.
Re^3: kill a process with process name
by BrowserUk (Patriarch) on Apr 14, 2010 at 14:12 UTC

    No. As you are redirecting all output to the nul device, you woudl have been better using system anyway. Backticks is only for when you want to retrieve the output.


    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.
      Instead of fork we're trying to use Win32::Job. I want some help on the watch().
      I want to kill the spawned process after a maximum timeout / if log file not updated. I tried watch(\&handler, maxTimeout) where handler() monitors the log file, but it dosen't work as I expected.
        Instead of fork we're trying to use Win32::Job.

        Can you explain why? There are a dozen or more modules out there for doing this kind of thing on Win32, but none of them are as well-tested, simple and reliable as system 1, $cnd;.

        There are a few good reasons for choosing on or other of those modules under some circumstances. Can you explain your choice?


        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.