in reply to Re^4: Pause and Resume Exe
in thread Pause and Resume Exe
Given count.pl that looks like this:
C:\test>type count.pl #! 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 count.pl', 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, count.pl will be suspended or resumed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Pause and Resume Exe
by gautamparimoo (Beadle) on Mar 01, 2013 at 05:41 UTC |