Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^4: Pause and Resume Exe

by gautamparimoo (Beadle)
on Feb 28, 2013 at 05:46 UTC ( #1020998=note: print w/replies, xml ) Need Help??

in reply to Re^3: Pause and Resume Exe
in thread Pause and Resume Exe

@BrowserUK . Plz elaborate how can tell the script A to suspend through script B(I cannot hardcode in script B to suspend for some time as that would be known only at runtime)and then resume again?

Replies are listed 'Best First'.
Re^5: Pause and Resume Exe
by BrowserUk (Pope) on Feb 28, 2013 at 12:10 UTC

    Given that looks like this:

    C:\test>type #! perl -slw use strict; use 5.010; say for 1 .. 1e6;

    You can run that script using this script:

    #! perl -slw use strict; use Win32::Process; Win32::Process::Create( my $hProc, '/perl64/bin/perl.exe', 'perl', 0, 0, '.' ) or die $^E; my $state = 1; while( <STDIN> ) { if( $state ) { $hProc->Suspend(); $state = 0; } else { $hProc->Resume(); $state = 1; } print "\nProcess is ", $state ? 'running' : 'suspended'; }

    And each time you press enter on the command line, will be suspended or resumed.

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    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.

      But again it keeps on waiting for some input from user as the process does not finish. It cmd running the process keeps on waiting. Why?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020998]
[Corion]: james28909: You can get a list of all modules on your Windows Perl via the autobundle command in the cpan shell. But that likely lists many more modules than you actually want. I recommend a clear separation and installing modules on ...
[Corion]: ... both Perls separately. I use cpanfiles or Makefile.PL for that - listing all modules for an application there allows me to install them via cpanm . or cpan . automatically without any further interaction

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2018-05-23 17:24 GMT
Find Nodes?
    Voting Booth?