Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Could it be that you are looking for Win32::Process? With that you can launch your command and specify $ProcessObj->Wait($timeout) which

    Wait for the process to die. $timeout should be specified in milliseconds. To wait forever, specify the constant INFINITE.
then to kill the process you could do something like $ProcessObj->Kill( $exitcode ) which
    Kill the associated process, have it terminate with exit code $ExitCode.
Update:
#! /usr/bin/perl use strict; use warnings; use Win32::Process; ###################################################################### +################## #MiscVariables my ($VERSION, $ProcessObj); ###################################################################### +################## $VERSION = "1.0.0"; Win32::Process::Create($ProcessObj, "$ENV{'SystemRoot'}/notepad.exe", "notepad test.txt", 0, # Don't inherit. NORMAL_PRIORITY_CLASS, ".") or die "Cannot Launch Anything\n"; if ($ProcessObj->Wait (10*1000)){ # execution of the process is successfully. $ProcessObj->Kill(0); print "Successful\n"; } else { # process has hung up for some reason print "The Process Hung - Killing it\n"; $ProcessObj->Kill(255); }

Update2: I seem to have gone down the wrong track.. :(

-----
Of all the things I've lost in my life, its my mind I miss the most.

In reply to Re: Timeouts/timers on Win32 system by AcidHawk
in thread Timeouts/timers on Win32 system by Dovkont

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (4)
    As of 2018-09-21 06:43 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Eventually, "covfefe" will come to mean:













      Results (184 votes). Check out past polls.

      Notices?
      • (Sep 10, 2018 at 22:53 UTC) Welcome new users!