<?xml version="1.0" encoding="windows-1252"?>
<node id="988919" title="Re^5: Stop a .exe" created="2012-08-21 21:15:00" updated="2012-08-21 21:15:00">
<type id="11">
note</type>
<author id="171588">
BrowserUk</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;i&gt;&lt;/i&gt;&lt;/blockquote&gt;

&lt;p&gt;I think I've managed to re-create the situation you are seeing. I believe you are suffering from buffering.

&lt;p&gt;Please try the following code and report your results. This isn't intended as a complete solution, but rather a diagnostic to understand your problem.


&lt;code&gt;
#! perl -slw
use strict;
use Win32::Socketpair qw[ winopen2 ];

## Run the command and get a bi-direction pipe to it.
my( $pid, $pipe ) = winopen2( 'RunMe.exe',  $ARGV[0 ] // 10 );

## preload the childs input buffer with the answer to the prompt;
print $pipe "\n";

## give the kid a chance to say whatever it has to say
sleep 2;

## a nonblocking read to grab whatever has made it through the buffers
## which if the kid produced less output than the size of its output buffer
## and didn't flush them, may be nothing at all
my $results = '';
sysread( $pipe, $results, 65536, length $results );

close $pipe;

print for split "\n", $results; ## May produce no output

&lt;/code&gt;


&lt;div class="pmsig"&gt;&lt;div class="pmsig-171588"&gt;
&lt;hr /&gt;
&lt;font size=1 &gt;
&lt;div&gt;With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'&lt;/div&gt;
&lt;div&gt;Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.&lt;/div&gt;
&lt;div&gt;"Science is about questioning the status quo. Questioning authority". &lt;/div&gt;
&lt;div&gt;In the absence of evidence, opinion is indistinguishable from prejudice.
&lt;p align=right&gt;[http://www.theregister.co.uk/2011/11/29/sas_versus_world_programming/|The start of some sanity?]&lt;/p&gt;&lt;/div&gt;
&lt;/font&gt;

&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
988631</field>
<field name="parent_node">
988724</field>
</data>
</node>
