Someone has to watch, system 1... never watched
With system 1, I can implement the watching by myself. My main focus was not so much, how to implement the "watch" logic, but to find an easy way to create a separate process (or thread), which can later be killed in a way that killing the process would automatically kill its childs. My first approach was to use system 1 for creating the process, and then remembering the PID, and later using kill -9 to kill this process.

When discussing this solution, BrowserUk suggested using Win32::Job instead. I was only vaguely famimilar with this module and new that I can use it to control a process in a way that I can kill a whole process tree (the childs of the process) easily, so I thought that maybe there is also some feature in Win32::Job which would do the spawning. It seems that I was wrong with this. Or I stay with my original solution of sticking with system 1 only and kill the process with -9 (negative kill signal also means to kill the process group, but I have yet to find out whether this really always works reliably on Windows).

So the safest way would probably be to spawn a separate process (using system 1, and within this process use Win32::Job to spawn my application and control it using watch.
-- 
Ronald Fischer <ynnor@mm.st>

In reply to Re^2: Win32::Job::watch vs. system(1,...) by rovf
in thread Win32::Job::watch vs. system(1,...) by rovf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.