in reply to Re^2: Stop a .exe
in thread Stop a .exe
Then you are using it wrong!
Using the perl script as a substitute for your runme.exe:
#! perl -slw use strict; printf "%030d\n", $_ for 1 .. 1e3; print "Press enter to exit";
And this Perl script to run the above using winopen2():
#! perl -slw use strict; use Win32::Socketpair qw[ winopen2 ]; ## Run the command and get a bi-direction pipe to it. my $pipe = winopen2( 'RunMe.pl' ); my @results = <$pipe>; print $pipe "\n"; print scalar @results; <STDIN>;
The latter reads a thousand lines from the former, sends "\n" to it which allows it to end, and then prints out the number of lines read (1001 including the "Press Enter to exit prompt") amd waits. If you check the task manager you'll see that the child process has terminated:
[12:05:50.87] C:\test>winopen2-test.pl 1001 [12:06:00.23] C:\test>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Stop a .exe
by anshumangoyal (Scribe) on Aug 21, 2012 at 13:14 UTC | |
by BrowserUk (Patriarch) on Aug 22, 2012 at 01:15 UTC |